Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Circles Intersection

You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$.

Write a program which prints:

"2" if $B$ is in $A$,

"-2" if $A$ is in $B$, 

"1" if circumference of $A$ and $B$ intersect, and

"0" if $A$ and $B$ do not overlap.

You may assume that $A$ and $B$ are not identical.

Input

The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:

$x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$

Output

For each dataset, print 2, -2, 1, or 0 in a line.

Sample Input

2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 2.0 4.1 0.0 2.0

Output for the Sample Input

2
0



Sample input:
2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 2.0 4.1 0.0 2.0


Sample output:
2
0

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

for _ in range(n):
    xa,ya,ra,xb,yb,rb = map(float, input().split())
    len=math.sqrt((xa-xb)**2+(ya-yb)**2)

    if len + rb <= ra:
        print("2")
    elif len < ra + rb:
        print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

for _ in range(n):
    xa,ya,ra,xb,yb,rb = map(float, input().split())
    len=math.sqrt((xa-xb)**2+(ya-yb)**2)

    if len + rb <= ra:
        print("2")
    elif len <= ra + rb:
        print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

for _ in range(n):
    xa,ya,ra,xb,yb,rb = map(float, input().split())
    len=math.sqrt((xa-xb)**2+(ya-yb)**2)

    if len + rb <= ra:
        print("2")
    elif len + ra <= rb:
        print("-2")
    elif len <= ra + rb:
        print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]:
	d=(a-c)**2+(b-d)**2
	if d>(r+s)**2:print 0
	elif d+min(r,s)>max(r,s):print 1
	elif r>s:print 2
	else:print -2

Submission status: Wrong Answer

Solution code:
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]:
	d=(a-c)**2+(b-d)**2
	if d>(r+s)**2:print 0
	elif d+min(r*r,s*s)>max(r*r,s*s):print 1
	elif r>s:print 2
	else:print -2

Submission status: Wrong Answer

Solution code:
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]:
	d=((a-c)**2+(b-d)**2)**0.5
	if d>(r+s):print 0
	elif d+min(r,s)>max(r,s):print 1
	elif r>s:print 2
	else:print -2

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2)
    if distance < ra + rb:
        if distance + ra < rb or distance + rb < ra:
            print("2")
        else:
            print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2)
    if distance < ra + rb:
        if (ra < rb and distance < ra) or (ra > rb and distance < rb):
            print("2")
        else:
            print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2)
    if distance < ra + rb:
        if (ra < rb and distance + ra < rb) or (ra > rb and distance + rb  < ra):
            print("2")
        else:
            print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if distance < ra + rb:
        if (ra < rb and distance + ra < rb) or (ra > rb and distance + rb  < ra):
            if ra < rb:
                print("-2")
            else:
                print("2")
        else:
            print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if ra + rb < distance:
        if (ra < rb and distance + ra < rb):
            print(-2)
        elif (rb < ra and distance + rb < ra):
            print(2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if ra + rb > distance:
        if (ra < rb and distance + ra < rb):
            print(-2)
        elif (rb < ra and distance + rb < ra):
            print(2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
for i in range(n):
    xa,ya,ra,xb,yb,rb=map(float,raw_input().split())
    d=((xa-xb)**2+(ya-yb)**2)**0.5
    if ra+rb<d:
        print 0
    elif ra>rb:
        print 2
    elif ra<rb:
        print -2
    else:
        print 1

Submission status: Wrong Answer

Solution code:

import sys,math
cases = int(input())
i = 0
while i < cases:
   for line in sys.stdin.readlines():
       xa , ya , ra , xb , yb , rb = map(float,line.split())
       dist = (yb - ya)*(yb - ya) + (xb - xa)*(xb - xa)
       dist = math.sqrt(dist)
       print(dist)
       if (ra < rb and dist == 0):
           print("-2")
       elif (rb < ra and dist == 0):
           print("2")
       elif dist < ra + rb:
           print("1")
       elif dist > ra + rb :
           print("0")
   i += 1

Submission status: Wrong Answer

Solution code:

import sys,math
cases = int(input())
i = 0
while i < cases:
   for line in sys.stdin.readlines():
       xa , ya , ra , xb , yb , rb = map(float,line.split())
       dist = (yb - ya)*(yb - ya) + (xb - xa)*(xb - xa)
       dist = math.sqrt(dist)
       if (ra < rb and dist == 0):
           print("-2")
       elif (rb < ra and dist == 0):
           print("2")
       elif (ra - rb or rb - ra) < dist < ra + rb:
           print("1")
       elif dist > ra + rb :
           print("0")
   i += 1

Submission status: Wrong Answer

Solution code:
from math import sqrt
num = int(input())
for _ in range(num):
    xa, ya, ra, xb, yb, rb = [float(el) for el in input().split(' ')]
    d = sqrt((xa-xb)**2 + (ya-yb)**2)
    if d < ra + rb:
        if ra > rb and d < ra - rb:
            print(2)
        elif rb > ra and d < rb -ra:
            print(-2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float,input().split()))
    dAB = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
    if ra + rb < dAB:
        print('0')
    elif dAB + rb < ra:
        print('2')
    elif dAB + ra < rb:
        print('-1')
    else:
        print('1')

Submission status: Wrong Answer

Solution code:
#encoding=utf-8

x = input()

for i in xrange(x):
	x1,y1,r1,x2,y2,r2 = map(float, raw_input().split())
	tag1 = (x1 - x2)**2 + (y1 - y2)**2
	tag2 = (r1 - r2)**2
	if tag1 <= tag2:
		tag3 = (r1 - (2/r2))**2
		tag4 = ((2/r1) - r2)**2
		if tag1 <= tag3 or tag1 <= tag4:
			if r1 > r2:
				print "2"
			else:
				print "-2"
		else:
			print "1"
	else:
		print "0"

Submission status: Wrong Answer

Solution code:

import math
x = input()

for i in xrange(x):
	x1,y1,r1,x2,y2,r2 = map(float, raw_input().split())
	d = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)

	if d <= r1 - r2:
		print "2"
	elif d <= r2 - r1:
		print "-2"
	elif r1 - r2 <= d and d <= r1 + r2:
		print "1"
	elif r2 - r1 <= d and d <= r1 + r2:
		print "1"
	else:
		print "0"

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import math

n = int(raw_input())
for i in range(n):
    x1, y1, r1, x2, y2, r2 = map(float, raw_input().split())
    d = math.sqrt(math.pow(x2-x1, 2) + math.pow(y2-y1, 2))
    if r2+d <= r1:
        print '2'
    elif r1+d <= r2:
        print '-2'
    elif r1+r2 >= d:
        print '1'
    else:
        print '0'

Submission status: Wrong Answer

Solution code:
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = math.sqrt((xa - xb) ** 2 + (ya - yb) ** 2)
    d2 = math.fabs(ra + rb)

    if d1 <= d2:
        if d1 <= ra or d1 <= rb:
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = math.sqrt((xa - xb) ** 2 + (ya - yb) ** 2)
    d2 = math.fabs(ra + rb)

    if d1 <= d2:
        if d1 < ra or d1 < rb:
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = (xa - xb) ** 2 + (ya - yb) ** 2
    d2 = ra ** 2 + rb ** 2
    dr = ra ** 2 - rb ** 2

    if d1 <= d2:
        if math.fabs(dr) > math.fabs(d1):
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = (xa - xb) ** 2 + (ya - yb) ** 2
    d2 = ra ** 2 + rb ** 2
    dr = (ra-rb) ** 2

    if d1 <= d2:
        if d2 > d1 > dr:
            print(1)
        elif dr > d1:
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = (xa - xb) ** 2 + (ya - yb) ** 2
    d2 = ra ** 2 + rb ** 2
    dr = (ra-rb) ** 2

    if d1 <= d2:
        if dr >= d1:
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math

n = input()
for i in xrange(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    d = math.sqrt(((xa - xb) ** 2) + ((ya - yb) ** 2))
    if ra + rb <= d: print 0
    elif ra + rb > d and math.fabs(ra - rb) < d: print 1
    else:
        if ra > rb: print 2
        else: print -2

Submission status: Wrong Answer

Solution code:
from fractions import Fraction as F
for _ in xrange(input()):
    x1, y1, r1, x2, y2, r2 = map(F, raw_input().split())
    d = (x1+x2)**2+(y1+y2)**2 
    if d < (r1-r2)**2:
        print 2 if r1 > r2 else -2
    elif (r1-r2)**2 <= d <= (r1+r2)**2:
        print 1
    else:
        print 0

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float,input().split())
    if (xa - xb)**2 + (ya - yb)**2 > (ra + rb)**2:
        print(0)
    elif rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2:
        print(-2)
    elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2:
        print(2)
    elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2:
        print(1)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float,input().split())
    if (xa - xb)**2 + (ya - yb)**2 > (ra + rb)**2:
        print("0")
    elif rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2:
        print("-2")
    elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2:
        print("2")
    elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2:
        print("1")

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float,input().split())
    if rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2:
        print("-2")
    elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2:
        print("2")
    elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2:
        print("1")
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float,input().split())
    dis = (xa - xb)**2 + (ya - yb)**2
    if dis > (ra + rb)**2:
        print(0)
    elif rb > ra and dis < (rb - ra)**2:
        print(-2)
    elif ra > rb and dis < (ra - rb)**2:
        print(2)
    elif (ra - rb)**2 < dis < (ra + rb)**2:
        print(1)

Submission status: Wrong Answer

Solution code:
import math
n = int(raw_input())

for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' '))
    d = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if d+rb <= ra:
        print 2
    elif d+ra <= rb:
        print -2
    elif d > ra+rb:
        print 0
    else:
        print 1

Submission status: Wrong Answer

Solution code:
import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb - distance > 10E-8: # B in A
		print(2)
	elif Rb - Ra - distance > 10E-8: # A in B
		print(-2)
	elif Ra + Rb - distance > 10E-8: # Intersect
		print(1)
	elif Ra + Rb - distance < 10E-8: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb - distance > 10E-8: # B in A
		print(2)
	elif Rb - Ra - distance > 10E-8: # A in B
		print(-2)
	elif Ra + Rb - distance > 10E-8: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:
import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb > distance: # B in A
		print(2)
	elif Rb - Ra > distance: # A in B
		print(-2)
	elif Ra + Rb > distance: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra > Rb + distance: # B in A
		print(2)
	elif Rb > Ra + distance: # A in B
		print(-2)
	elif Ra + Rb > distance: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	#[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	[Xa,Ya,Ra,Xb,Yb,Rb] = map(float,input().split())
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb > distance: # B in A
		print(2)
	elif Rb - Ra > distance: # A in B
		print(-2)
	elif Ra + Rb > distance: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:
import math

N = eval(input())
while N != 0:
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb > distance: # B in A
		print(2)
	elif Rb - Ra > distance: # A in B
		print(-2)
	elif Ra + Rb > distance: # Intersect
		print(1)
	else: # Not overlap
		print(0)
	N -= 1

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if abs(Ra - Rb - distance) > 10E-8: # B in A
		print(2)
	elif abs(Rb - Ra - distance) > 10E-8: # A in B
		print(-2)
	elif abs(Ra + Rb - distance) > 10E-8: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb - distance > -10E-8: # B in A
		print(2)
	elif Rb - Ra - distance > -10E-8: # A in B
		print(-2)
	elif Ra + Rb - distance > -10E-8: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = eval(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb - distance > -10E-16: # B in A
		print(2)
	elif Rb - Ra - distance > -10E-16: # A in B
		print(-2)
	elif Ra + Rb - distance > -10E-16: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:

import math

N = int(input())
for _ in range(N):
	[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()]
	distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B
	if Ra - Rb - distance > -10E-16: # B in A
		print(2)
	elif Rb - Ra - distance > -10E-16: # A in B
		print(-2)
	elif Ra + Rb - distance > -10E-16: # Intersect
		print(1)
	else: # Not overlap
		print(0)

Submission status: Wrong Answer

Solution code:
import math
def check_intersect(x1,y1,r1,x2,y2,r2):
    d = math.sqrt((x2-x1)**2 + (y2-y1)**2)
    
    if d >= r1+r2:
        print(0)
    elif d + r1 <= r2:
        print(-2)
    elif d + r2 <= r1:
        print(2)
    elif d <= r1*r2:
        print(1)
    return 0

n = int(input())
for i in range(n):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    check_intersect(x1,y1,r1,x2,y2,r2)

Submission status: Wrong Answer

Solution code:
import math

def check_intersect(x1,y1,r1,x2,y2,r2):
    d = math.sqrt((x2-x1)**2 + (y2-y1)**2)
    
    if d >= r1+r2:
        print(0)
    elif d + r1 <= r2:
        print(-2)
    elif d + r2 <= r1:
        print(2)
    elif d <= r1+r2:
        print(1)
    return 0

n = int(input())
for i in range(n):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    check_intersect(x1,y1,r1,x2,y2,r2)

Submission status: Wrong Answer

Solution code:
import math

def check_intersect(x1,y1,r1,x2,y2,r2):
    d = math.sqrt((x2-x1)**2 + (y2-y1)**2)    
    if d > r1+r2:
        print(0)
    elif d + r1 <= r2:
        print(-2)
    elif d + r2 <= r1:
        print(2)
    elif d <= r1+r2:
        print(1)
    return 0

n = int(input())
for i in range(n):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    check_intersect(x1,y1,r1,x2,y2,r2)

Submission status: Wrong Answer

Solution code:
import math

def check_intersect(x1,y1,r1,x2,y2,r2):
    d = math.sqrt((x2-x1)**2 + (y2-y1)**2)    

    if r1 < r2 and d + r1 <= r2:
        print(-2)
    elif r1 > r2 and d + r2 <= r1:
        print(2)
    elif d > r1+r2:
        print(0)
    elif d <= r1+r2:
        print(1)
    return 0

n = int(input())
for i in range(n):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    check_intersect(x1,y1,r1,x2,y2,r2)

Submission status: Wrong Answer

Solution code:


import math


num = int(input())

for i in range(num):
    ax,ay,ar,bx,by,br = map(float,input().split(' '))
    d = (ax - bx)*(ax - bx) + (ay * by)
    if d < (br - ar):
            print(2)
    if d < (ar - br):
            print(-2)
    elif d <= (ar + br):
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:


import math


num = int(input())

for i in range(num):
    ax,ay,ar,bx,by,br = map(float,input().split(' '))
    d = (ax - bx)*(ax - bx) + (ay * by)
    if d < (ar - br):
            print(2)
    if d < (br - ar):
            print(-2)
    elif d <= (ar + br):
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:


import math


num = int(input())

for i in range(num):
    ax,ay,ar,bx,by,br = map(float,input().split(' '))
    d = (ax - bx)*(ax - bx) + (ay * by)
    if d < abs(br - ar):
        if ar > br:
            print(2)
        else:
            print(-2)
    elif d <= ar + br:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:


import math


num = int(input())

for i in range(num):
    ax,ay,ar,bx,by,br = map(float,input().split(' '))
    d = (ax - bx)**2 + (ay * by)**2
    if d < abs(br - ar):
        if ar > br:
            print(2)
        else:
            print(-2)
    elif d <= ar + br:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n = input()
for i in range(int(n)):
    xa, ya, ra, xb, rb, yb = list(map(float, input().split(" ")))
    d = abs(complex(xb-xa, yb-ya))
    if ra + rb < d:
        print("0")
    elif abs(rb-ra) <= d <= ra+rb:
        print("1")
    elif d < abs(ra-rb):
        print("2" if ra > rb else "-2")

Submission status: Wrong Answer

Solution code:
# ??????????????¢??¨????????????, ????????¢???
def plus(a, b):
    return a + b


def minus(a, b):
    return abs(a - b)


def distance(x1, y1, x2, y2):
    r2 = (x1 - x2)**2 + (y1 - y2)**2
    return pow(r2, 0.5)


def flag(l):
    rp = plus(l[2], l[5])
    rm = minus(l[2], l[5])
    d = distance(l[0], l[1], l[3], l[4])
    if rp < d:
        return 0
    elif d < rm:
        return 2
    else:
        return 1


N = int(input())
for i in range(N):
    a = list(map(float, input().split()))
    print(flag(a))

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if d < ra - rb:
        print(2)
    elif d < rb - ra:
        print(-2)
    elif abs(rb - ra) < d and d < ra + rb:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
for i in range(int(input())):
    points = input().split()
    p = list(map(float,points))
    if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= p[2]**2:
        print(2)
    elif (p[0]-p[3])**2 + (p[1]-p[4])**2 < p[5]**2:
        print(-2)
    elif (p[3]-p[0])**2 + (p[4]-p[1])**2 < (p[2]+p[5])**2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
for i in range(int(input())):
    points = input().split()
    p = list(map(float,points))
    if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= p[2]**2:
        print(2)
    elif (p[0]-p[3])**2 + (p[1]-p[4])**2 <= p[5]**2:
        print(-2)
    elif (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]+p[5])**2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
    points = input().split()
    p = list(map(float,points))
    if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]-p[5])**2:
        if p[5]>p[2]:
            print(-2)
        else:
            print(2)
    elif (p[0]-p[3])**2 + (p[1]-p[4])**2 > (p[2]-p[5])**2 and (p[0]-p[3])**2 + (p[1]-p[4])**2 < (p[2]+p[5])**2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
    points = input().split()
    p = list(map(float,points))
    if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]-p[5])**2:
        if p[5]>p[2]:
            print(-2)
        else:
            print(2)
    elif (p[0]-p[3])**2 + (p[1]-p[4])**2 > (p[2]-p[5])**2 and (p[0]-p[3])**2 + (p[1]-p[4])**2 <= (p[2]+p[5])**2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import math


def square(number: float) -> float:
    return number * number


if __name__ == '__main__':
    N = int(input())
    for i in range(N):
        xa, ya, ra, xb, yb, rb = map(float, input().split())
        distance = math.sqrt(square(xb - xa) + square(yb - ya))
        if distance > (ra + rb):
            print(0)
        elif distance >= math.fabs(ra - rb):
            print(1)
        elif distance < math.fabs(ra - rb):
            if ra > rb:
                print(2)
            elif ra < rb:
                print(1)
        else:
            pass

Submission status: Wrong Answer

Solution code:
n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    dist = ((xa - xb)**2 + (ya - yb)**2)**.5
    if ra + rb < dist:
        print('0')
    elif (rb < ra) and (dist < ra):
        print('2')
    elif (ra < rb) and (dist < rb):
        print('-2')
    else:
        print('1')

Submission status: Wrong Answer

Solution code:
import math
count = int(input())
for i in range(count):
    x1,y1,r1,x2,y2,r2 =map(float,input().split())
    depth=math.sqrt((x1-x2)**2+(y1-y2)**2)
    if depth+r2<=r1:
        print(2)
    elif depth>r1+r2:
        print(0)
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
import math
count = int(input())
for i in range(count):
    x1,y1,r1,x2,y2,r2 =map(float,input().split())
    depth=math.sqrt((x1-x2)**2+(y1-y2)**2)
    if depth+r2<=r1:
        print(2)
    elif depth+r1<=r2:
        print(-2)
    elif depth>r1+r2:
        print(0)
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import math

n = input()

for i in range(n):
    slist = []
    slist = map(float, raw_input().split())
    kyouri = (slist[0] - slist[3]) * (slist[0] - slist[3]) + \
        (slist[1] - slist[4]) * (slist[1] - slist[4])
    r = math.sqrt(kyouri)
    sa = slist[2] - r
    if sa < 0:
        if abs(sa) < slist[5]:
            if slist[5] > r + slist[2]:
                print-2
            else:
                print 1
        else:
            print 0
    else:
        if slist[5] < sa:
            print 2
        elif 2 * r - sa < slist[5]:
            print -2
        else:
            print 1

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import math

n = input()

for i in range(n):
    slist = []
    slist = map(float, raw_input().split())
    kyouri = (slist[0] - slist[3]) * (slist[0] - slist[3]) + \
        (slist[1] - slist[4]) * (slist[1] - slist[4])
    r = math.sqrt(kyouri)
    sa = slist[2] - r
    if sa < 0:
        if abs(sa) < slist[5]:
            if slist[5] > r + slist[2]:
                print-2
            else:
                print 1
        else:
            print 0
    else:
        if slist[5] < sa:
            print 2
        elif 2 * r - sa < slist[5]:
            print -2
        else:
            print 1,

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
for i in range(n):
    x1,y1,r1,x2,y2,r2=map(float,raw_input().split())
    d = ((x2-x1)**2+(y2-y1)**2)**0.5
    if d+r2<=r1:
        print 2
    elif d+r1<=r2:
        print -2
    elif r1+r2>= d:
        print 1
    elif r1+r2<d:
        print 0
    else:
        print "error"

Submission status: Wrong Answer

Solution code:
for _ in[0]*int(input()):
 x,y,r,s,t,u=map(float,input().split())
 d=((x-s)**2+(y-t)**2)**.5
 print([[[1,2][d<u-r],[1,2][d<r-u]][r>u],0][r+u<d])

Submission status: Wrong Answer

Solution code:
import math
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if ra + rb < d:
        print(0)
    elif d + ra <= rb:
        print(-2)
    elif d + rb <= ra:
        print(2)
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.sqrt((x1-x2)**2+(y1-y2)**2)
    if dist <= abs(r1-r2):
        print(2 if r1 > r2 else -2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.sqrt((x1-x2)**2+(y1-y2)**2)
    if dist+r2 <= r1:
        print(2)
    elif dist+r1 <= r2:
        print(-2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.hypot(x1-x2, y1-y2)
    if dist+r2 <= r1:
        print(2)
    elif dist+r1 <= r2:
        print(-2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.hypot(x2-x1, y2-y1)
    if dist+r2 <= r1:
        print(2)
    elif dist+r1 <= r2:
        print(-2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

def dist(x1, y1, x2, y2):
    return ((x1 - x2)**2 + (y1 - y2)**2)**Decimal('0.5')

N = int(raw_input())
while (N):
    N -= 1
    xa, ya, ra, xb, yb, rb = map(Decimal, raw_input().split())
    d = dist(xa, ya, xb, yb)
    if d + rb <= ra:
        s = 2
    elif d + ra <= rb:
        s = -2
    elif d <= ra + rb:
        s = 1
    else:
        s = 0
    print s

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

def dist(x1, y1, x2, y2):
    return ((x1 - x2)**2 + (y1 - y2)**2)**Decimal('0.5')

N = int(raw_input())
while (N):
    N -= 1
    xa, ya, ra, xb, yb, rb = map(Decimal, raw_input().split())
    d = dist(xa, ya, xb, yb)
    if d + rb < ra:
        s = 2
    elif d + ra < rb:
        s = -2
    elif d < ra + rb:
        s = 1
    else:
        s = 0
    print

Submission status: Wrong Answer

Solution code:
import math
N = input()
answers = []
for val in range(1,N+1):
	x = map(float,raw_input().split(' '))
	d = (x[0]-x[3])**2 + (x[1]-x[4])**2
	math.sqrt(d)
	math.fabs(d)
	s = x[2]+x[5]
	r = math.fabs(x[2]-x[5])
	if r >= d:
		if x[2] > x[5]:
			answers.append(2)
		else:
			answers.append(-2)
	elif s < d:
		answers.append(0)
	else:
		answers.append(1)
for val in answers:
	print val

Submission status: Wrong Answer

Solution code:
import math
N = input()
answers = []
for val in range(1,N+1):
	x = map(float,raw_input().split(' '))
	d = (x[0]-x[3])**2 + (x[1]-x[4])**2
	math.sqrt(d)
	math.fabs(d)
	s = x[2]+x[5]
	r = math.fabs(x[2]-x[5])
	if r >= d:
		if x[2] > x[5]:
			answers.append(2)
		else:
			answers.append(-2)
	elif s >= d:
		answers.append(1)
	else:
		answers.append(0)
for val in answers:
	print val

Submission status: Wrong Answer

Solution code:

import sys
import math


class Circle:
    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r

    def distance(self, other):
        dx = self.x - other.x
        dy = self.y - other.y
        return math.sqrt(dx ** 2 + dy ** 2)

    def intersection(self, other):
        d = self.distance(other)
        if self.r > d + other.r:
            return 2
        elif other.r > d + self.r:
            return -2
        elif d < self.r + other.r:
            return 1
        else:
            return 0


#input_file = open(sys.argv[1], "r")

sys.stdin.readline()

for line in sys.stdin:
    (xa, ya, ra, xb, yb, rb) = tuple(map(float, line.split(' ')))
    ca = Circle(xa, ya, ra)
    cb = Circle(xb, yb, rb)
    print ca.intersection(cb)