submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s128079205
p00023
Wrong Answer
from math import hypot n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = hypot(xb - xa, yb - ya) if d < ra - rb: print(2) elif d < rb - ra: print(-2) elif d < ra + rb: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s302002874
p00023
Accepted
for i in range(int(input())): xa, ya, ra, xb, yb, rb = map(float, input().split(' ')) ab_length = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5 if ra > rb: max_r, min_r, min_c = ra, rb, 2 else: max_r, min_r, min_c = rb, ra, -2 if ab_length > ra + rb: ans = 0 elif ab_length <= ra + rb: if ab_length + min_r < max_r: ans = min_c else: ans = 1 print(ans)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s257754719
p00023
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys input() for s in sys.stdin: d = map(float,s.split()) xa,ya,ra,xb,yb,rb = d[0],d[1],d[2],d[3],d[4],d[5] if ((xa-xb)**2+(ya-yb)**2)**0.5 > ra + rb: print 0 elif ((xa-xb)**2+(ya-yb)**2)**0.5 + rb < ra : print 2 elif ((xa-xb)**2+(ya-yb)**2)**0.5 + ra < rb : print -2 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s780886508
p00023
Accepted
import sys f = sys.stdin n = int(f.readline()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, f.readline().split()) xya, xyb = xa + ya * 1j, xb + yb * 1j dist = abs(xya - xyb) if ra + rb < dist: print(0) elif ra > rb + dist: print(2) elif rb > ra + dist: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s807311235
p00023
Accepted
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")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s208253989
p00023
Accepted
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
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s665799566
p00023
Accepted
import math def calculate(): if ra + rb < d: print 0 elif abs(ra - rb) <= d <= ra + rb: print 1 elif rb > ra and d < rb - ra: print -2 elif ra > rb and d < ra - rb: print 2 N = int(raw_input()) for i in range(N): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) d = math.sqrt((xb-xa)**2 + (yb-ya)**2) calculate()
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s014955441
p00023
Accepted
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 (distance + ra < rb): print(-2) elif (distance + rb < ra): print(2) else: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s640730979
p00023
Accepted
n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = ((xa - xb)**2 + (ya - yb)**2)**0.5 if d > ra + rb: print(0) elif ra + d < rb: print(-2) elif rb + d < ra: print(2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s355801128
p00023
Accepted
# -*- coding:utf-8 -*- def main(): import math for i in range(int(input())): xa,ya,ra,xb,yb,rb=map(float,input().split()) d=math.sqrt((xa-xb)**2+(ya-yb)**2) if d>ra+rb: print(0) elif ra+rb>=d and d>=abs(ra-rb): print(1) elif d<abs(ra-rb): if ra>rb: print(2) elif ra<rb: print(-2) if __name__ == '__main__': main()
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s498794974
p00023
Accepted
import math n = int(raw_input()) for i in range(0, n): xa,ya,ra,xb,yb,rb = map(float,raw_input().split()) distance = math.hypot(xa - xb, ya - yb) if distance + rb < ra: print 2 elif distance + ra < rb: print -2 elif ra + rb >= distance: print 1 elif ra + rb < distance: print 0
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s984548165
p00023
Accepted
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 if d+rb<ra else 1 else: print -2 if d+ra<rb else 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s065608611
p00023
Accepted
n = int(input()) for i in range(n): x1, y1, r1, x2, y2, r2 = map(float, input().split()) a = complex(x1, y1) b = complex(x2, y2) d = abs(a - b) if d < r1 - r2: print(2) elif d < r2 - r1: print(-2) elif d <= r1 + r2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s835867288
p00023
Accepted
from math import sqrt n = int(input()) while n: xa, ya, ra, xb, yb, rb = map(float, input().split()) d = sqrt((xb - xa) ** 2 + (yb - ya) ** 2) if ra > d + rb: print(2) elif rb > d + ra: print(-2) elif d > ra + rb: print(0) else: print(1) n -= 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s473597021
p00023
Accepted
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('-2') else: print('1')
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s319449831
p00023
Accepted
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 "0" elif abs(r1 - r2) <= d <= r1 + r2: print "1" elif d < abs(r1 + r2): if r1 > r2: print "2" else: print "-2"
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s214783165
p00023
Accepted
# -*- 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'
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s290982800
p00023
Accepted
n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb, = map(float, input().split()) dsq = (xa - xb)**2 + (ya -yb)**2 if dsq > (ra + rb)**2: print('0') elif dsq < (ra - rb)**2: if ra > rb: print('2') else: print('-2') else: print('1')
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s297419016
p00023
Accepted
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 + 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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s541509824
p00023
Accepted
import math for _ in range(int(input())): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = math.hypot(xb - xa, yb- ya) if d > ra + rb: print(0) elif abs(ra - rb) <= d: print(1) else: print(2 if rb < ra else -2)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s634810445
p00023
Accepted
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 abs(ra - rb) <= d: print 1 else: print 2 if ra > rb else -2
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s074472619
p00023
Accepted
import math N = int(input()) for i in range(N): x1,y1,r1,x2,y2,r2 = map(float,input().split()) d = math.sqrt(pow(x1 - x2,2.0) + pow(y1 - y2,2.0)) if d < abs(r2 - r1): if r1 > r2: print(2) else: print(-2) elif d <= r1 + r2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s224783379
p00023
Accepted
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
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s600139381
p00023
Accepted
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) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s084327125
p00023
Accepted
import math n=int(input()) for i in range(n): ax,ay,ar,bx,by,br=[float(i) for i in input().split()] ab=abs(math.sqrt(pow(ax-bx,2)+pow(ay-by,2))) if ar>ab and (ar-ab)>br: print(2) elif br>ab and(br-ab)>ar: print(-2) elif ab<=(ar+br): print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s327538076
p00023
Accepted
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
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s599370941
p00023
Accepted
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 < math.sqrt((r1-r2)**2): if r1 > r2: print('2') else:print('-2') else: print('1') 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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s306157849
p00023
Accepted
def f(): ax,ay,ar,bx,by,br=map(float,input().split()) d=((ax-bx)* (ax - bx))+((ay-by)*(ay-by)) r1=(ar+br)*(ar+br) r2=(ar-br)*(ar-br) if d<=r1 and d>=r2:return 1; elif d<r2 and ar>=br:return 2 elif d < r2 and ar <= br:return -2 else:return 0 for _ in range(int(input())):print(f())
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s553547641
p00023
Accepted
def f(): ax,ay,ar,bx,by,br=map(float,input().split()) d=(ax-bx)**2+(ay-by)**2 r1=(ar+br)*(ar+br) r2=(ar-br)*(ar-br) if d<=r1 and d>=r2:return 1; elif d<r2 and ar>=br:return 2 elif d < r2 and ar <= br:return -2 else:return 0 for _ in range(int(input())):print(f())
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s430843939
p00023
Accepted
import math def to_f(e): return float(e) n = int(raw_input().rstrip()) for i in range(n): line = raw_input().rstrip() l = map(to_f, line.split(" ")) xa = l[0] ya = l[1] ra = l[2] xb = l[3] yb = l[4] rb = l[5] dist = math.sqrt((xa-xb)**2 + (ya-yb)**2) if ra > rb and dist < ra-rb: print 2 elif rb > ra and dist < rb-ra: print -2 elif dist <= ra + rb and dist >= ra-rb: print 1 else: print 0
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s404519947
p00023
Accepted
import math def aux(v): [xa,ya,ra,xb,yb,rb] = v ab = math.sqrt((xb-xa)**2 + (yb-ya)**2) if ab > ra + rb: rst = 0 elif ab + rb < ra: rst = 2 elif ab + ra < rb: rst = -2 else: rst = 1 return(rst) if __name__ == "__main__": n = int(input()) for i in range(n): v = list(map(float, input().split())) print(aux(v))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s507332457
p00023
Accepted
n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distsq = (xa-xb)**2 + (ya-yb)**2 if distsq < (ra-rb)**2: if ra < rb: print(-2) else: print(2) elif (ra-rb)**2 <= distsq <= (ra+rb)**2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s910666107
p00023
Accepted
# -*- coding: utf-8 -*- import sys import os import math N = int(input()) for i in range(N): ax, ay, ar, bx, by, br = map(float, input().split()) between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 ) # ????????£???????????? if between_center > ar + br: print(0) # ????????????????????¨ else: # B in A if ar > between_center + br: print(2) # A in B elif br > between_center + ar: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s221486697
p00023
Accepted
# -*- coding: utf-8 -*- import sys import os import math N = int(input()) for i in range(N): ax, ay, ar, bx, by, br = map(float, input().split()) between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 ) # ????????£???????????? if between_center > ar + br: print(0) # ????????????????????¨ else: # B in A if ar > between_center + br: print(2) # A in B elif br > between_center + ar: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s011355574
p00023
Accepted
# -*- coding: utf-8 -*- import sys import os import math N = int(input()) for i in range(N): ax, ay, ar, bx, by, br = map(float, input().split()) between_center = math.hypot(ax - bx, ay - by) # ????????£???????????? if between_center > ar + br: print(0) # ????????????????????¨ else: # B in A if ar > between_center + br: print(2) # A in B elif br > between_center + ar: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s853368534
p00023
Accepted
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)*(ay-by)) r1 = (ar+br)*(ar+br) r2 = (ar-br)*(ar-br) if d <= r1 and d >= r2: print(1); elif d<r2 and ar>=br: print(2) elif d < r2 and ar <= br: print(-2) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s284343006
p00023
Accepted
n = int(input()) for i in range(n): k = input() xa, ya, ra, xb, yb, rb = list(map(float, k.split(" "))) d = abs(complex(xb-xa, yb-ya)) if ra + rb < d: print("0") elif abs(rb-ra) <= d <= ra+rb: print("1") else: print("2" if ra > rb else "-2")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s531158254
p00023
Accepted
N=int(input()) x_a=[0]*N y_a=[0]*N r_a=[0]*N x_b=[0]*N y_b=[0]*N r_b=[0]*N for i in range(N): x_a[i],y_a[i],r_a[i],x_b[i],y_b[i],r_b[i]=map(float,input().split()) for i in range(N): AB=((x_a[i]-x_b[i])**2+(y_a[i]-y_b[i])**2)**(1/2) r_diff=abs(r_a[i]-r_b[i]) if AB > r_a[i]+r_b[i]: print(0) elif r_a[i]+r_b[i] >= AB and AB >= r_diff: print(1) else: if r_a[i] > r_b[i]: print(2) else: print(-2)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s313169123
p00023
Accepted
def dist(P, Q): return ((P[0] - Q[0]) ** 2 + (P[1] - Q[1]) ** 2) ** 0.5 n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) A, B = (xa, ya), (xb, yb) if dist(A, B) > ra + rb: print(0) elif dist(A, B) + ra < rb: print(-2) elif dist(A, B) + rb < ra: print(2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s266458797
p00023
Accepted
import sys def solve(circleA, circleB): xa, ya, ra = circleA xb, yb, rb = circleB # ?????????????????????????????????????????´???????????? if ra <= rb: if distancePow2(xa, ya, xb, yb) < pow(rb - ra, 2): return -2 else: if distancePow2(xa, ya, xb, yb) < pow(rb - ra, 2): return 2 # ??±??????????????????????????? if pow(rb - ra, 2) <= distancePow2(xa, ya, xb, yb) <= pow(rb + ra, 2): return 1 return 0 def distancePow2(xa, ya, xb, yb): return pow(xb - xa, 2) + pow(yb - ya, 2) n = int(input()) for i in range(0, n): inStr = input() circleAInfo = [float(data) for data in inStr.split(" ")[0:3]] circleBInfo = [float(data) for data in inStr.split(" ")[3:6]] print(solve(circleAInfo, circleBInfo))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s933663068
p00023
Accepted
# ??????????????¢??¨????????????, ????????¢??? 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: if l[5] < l[2]: return 2 else: return -2 else: return 1 N = int(input()) for i in range(N): a = list(map(float, input().split())) print(flag(a))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s242112663
p00023
Accepted
# Aizu Problem 0023: Circles Intersection # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def check_circles(xa, ya, ra, xb, yb, rb): dist = math.sqrt((xa - xb)**2 + (ya - yb)**2) if dist > ra + rb: return 0 if ra > rb and dist < ra - rb: return 2 if rb > ra and dist < rb - ra: return -2 return 1 N = int(input()) for n in range(N): xa, ya, ra, xb, yb, rb = [float(_) for _ in input().split()] print(check_circles(xa, ya, ra, xb, yb, rb))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s797579577
p00023
Accepted
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0023&lang=jp """ import sys from sys import stdin from math import sqrt input = stdin.readline def main(args): N = int(input()) for _ in range(N): x_a, y_a, r_a, x_b, y_b, r_b = map(float, input().split()) distance = sqrt((x_a - x_b) ** 2 + (y_a - y_b) ** 2) if r_a + r_b < distance: result = 0 elif r_a > distance + r_b: result = 2 elif r_b > distance + r_a: result = -2 else: result = 1 print(result) if __name__ == '__main__': main(sys.argv[1:])
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s133859072
p00023
Accepted
n = input() for i in range(n): xa,ya,ra,xb,yb,rb = map(float, raw_input().split()) if abs(ra-rb) <= ((xa-xb)**2+(ya-yb)**2)**0.5 <= ra+rb: print 1 elif abs(ra-rb) >= ((xa-xb)**2+(ya-yb)**2)**0.5: if rb < ra: print 2 else: print -2 else: print 0
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s873718617
p00023
Accepted
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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s969308401
p00023
Accepted
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 d <= ra + rb: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s315627077
p00023
Accepted
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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s760120339
p00023
Accepted
# 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(-2) else: pass
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s189131538
p00023
Accepted
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 abs(ra - rb) <= dist: print('1') elif (rb < ra): print('2') elif (ra < rb): print('-2')
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s342001263
p00023
Accepted
import math count = int(input()) for i in range(count): x1,y1,r1,x2,y2,r2 =map(float,input().split()) depth=(x1-x2)**2+(y1-y2)**2 if depth> (r1+r2)**2: print(0) elif depth <(r1-r2)**2: if r1>r2: print(2) else: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s643046833
p00023
Accepted
import math n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = math.sqrt((xa - xb)**2 + (ya - yb)**2) if ra > d + rb: print("2") elif rb > d + ra: print("-2") elif d > ra + rb: print("0") else: print("1")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s204579079
p00023
Accepted
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 0 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s093042757
p00023
Accepted
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])
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s327538347
p00023
Accepted
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,0][r+u<d],-2][d<u-r],2][d<r-u])
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s685818836
p00023
Accepted
import math n=int(input()) for _ in range(n): l=[float(i) for i in input().split()] d=math.hypot(l[3]-l[0],l[4]-l[1]) print([2,-2,1,0][[d<l[2]-l[5],d<l[5]-l[2],d<=l[2]+l[5],d>l[2]+l[5]].index(True)])
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s512755526
p00023
Accepted
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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s077872634
p00023
Accepted
import math def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = int(input()) for l in range(N): xa,ya,ra,xb,yb,rb = [float(i) for i in input().split()] d = math.sqrt((xa-xb)**2 + (ya-yb)**2) if d < ra-rb: print(2) elif d < rb-ra: print(-2) elif d > ra+rb: print(0) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s378250341
p00023
Accepted
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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s792642502
p00023
Accepted
# AOJ 0023 Circles Intersection # Python3 2018.6.16 bal4u n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) ans = 1 d = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb); if d > (ra + rb)*(ra + rb): ans = 0 elif d < (ra - rb)*(ra - rb): ans = 2 if ra > rb else -2 print(ans)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s664435670
p00023
Accepted
import sys import math N = int(sys.stdin.readline().strip()) def calc(xa, ya, ra, xb, yb, rb): dist = math.sqrt((yb - ya) **2 + (xb - xa) **2) if dist > (ra + rb): return 0 elif abs(ra - rb) <= dist <= (ra + rb): return 1 elif dist < abs(ra - rb): if ra > rb: return 2 else: return -2 for i in xrange(N): line = sys.stdin.readline().strip() xa, ya, ra, xb, yb, rb = map(float, line.split()) print calc(xa, ya, ra, xb, yb, rb)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s779976900
p00023
Accepted
for i in range(input()): 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 2 elif rb>ra+d:print -2 elif d>ra+rb:print 0 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s525916168
p00023
Accepted
import math for i in range(int(raw_input())): (xa, ya, ra, xb, yb, rb) = map(float,raw_input().split()) dist = math.sqrt((xa-xb)**2 + (ya-yb)**2) if dist > ra + rb: print 0 elif dist + rb < ra: print 2 elif dist + ra < rb: print -2 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s875103890
p00023
Accepted
import sys import math N = int(sys.stdin.readline().strip()) def calc(xa, ya, ra, xb, yb, rb): dist = math.sqrt((yb - ya) **2 + (xb - xa) **2) if dist > (ra + rb): return 0 elif abs(ra - rb) <= dist <= (ra + rb): return 1 elif dist < abs(ra - rb): if ra > rb: return 2 else: return -2 for i in xrange(N): line = sys.stdin.readline().strip() xa, ya, ra, xb, yb, rb = map(float, line.split()) print calc(xa, ya, ra, xb, yb, rb)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s315910059
p00023
Accepted
from __future__ import (division, absolute_import, print_function, unicode_literals) from sys import stdin from math import hypot, copysign for n in xrange(int(stdin.readline())): xa, ya, ra, xb, yb, rb = (float(s) for s in stdin.readline().split()) distance = hypot(xa - xb, ya - yb) diff = ra - rb if ra + rb < distance: print('0') elif abs(diff) <= distance: print('1') else: print(int(copysign(2, diff)))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s138023199
p00023
Accepted
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) sr = ra + rb dr = abs(ra - rb) if d > sr: s = 0 elif d < sr and dr < d: s = 1 elif dr > d: s = 2 if ra > rb else -2 else: s = 1 print s
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s960080173
p00023
Accepted
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 d = math.sqrt(d) d = math.fabs(d) s = x[2]+x[5] r = math.fabs(x[2]-x[5]) if d > s: answers.append(0) elif d == s: answers.append(1) elif d < s: if d < r: if x[2] > x[5]: answers.append(2) else: answers.append(-2) elif d >= r: answers.append(1) for val in answers: print val
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s661427330
p00023
Accepted
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)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s573146169
p00023
Accepted
import math n = input() for i in range(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) r = ((xa-xb)**2 + (ya-yb)**2)**.5 if ra+rb<r: print 0 elif abs(ra-rb)<=r: print 1 elif ra-rb>r: print 2 else: print -2
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s294006803
p00023
Accepted
n = input() for i in range(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) r = ((xa-xb)**2 + (ya-yb)**2)**.5 if ra+rb<r: print 0 elif ra-rb>r: print 2 elif rb-ra>r: print -2 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s918876641
p00023
Accepted
n = int(raw_input()) for _ in range(n): xa,ya,ra,xb,yb,rb = map(float, raw_input().split()) d = ((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)) sr = ((ra + rb) * (ra + rb)) dr = ((ra - rb) * (ra - rb)) if d > sr: print 0 elif (d < sr and dr < d): print 1 elif dr > d: if ra > rb: print 2 else: print -2 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s055729599
p00023
Accepted
import math n = int(raw_input()) for i in xrange(n): data = map(float, raw_input().strip().split()) xa = data[0] ya = data[1] ra = data[2] xb = data[3] yb = data[4] rb = data[5] d = math.sqrt((xa - xb)**2 + (ya - yb)**2) if d < ra - rb: print 2 elif d < rb - ra: print -2 elif d <= ra + rb: print 1 else: print 0
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s160252783
p00023
Accepted
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 ra+rb < d: print 0 elif ra >= rb: if d+rb < ra: print 2 else: print 1 elif ra < rb: if d+ra < rb: print -2 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s522221155
p00023
Accepted
n = input() while n: xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) r = ((xa-xb)**2 + (ya-yb)**2)**.5 if ra+rb<r: x=0 elif ra-rb>r: x=2 elif rb-ra>r: x=-2 else: x=1 print x n-=1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s407429695
p00023
Accepted
import math def length(xa, ya, xb, yb): return math.sqrt((xa - xb)**2 + (ya - yb)**2) n = int(raw_input()) for s in range(0, n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' ')) d = length(xa, ya, xb, yb) if ra > rb + d: print 2 elif rb > ra + d: print -2 elif d > ra + rb: print 0 else: print 1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s770902487
p00023
Accepted
# your code goes here import math n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = [float(x) for x in input().split(" ")] distance = math.sqrt((xb-xa)**2 + (yb-ya)**2) if distance > ra+rb: print(0) elif distance < abs(ra-rb): if ra > rb: print(2) elif ra < rb: print(-2) else: print(1) elif distance <= ra+rb: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s620266537
p00023
Accepted
import math n = input() for i in xrange(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) l = math.hypot(xa - xb, ya - yb) if l + rb < ra: print 2 elif l + ra < rb: print -2 elif l <= ra + rb: print 1 else: print 0
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s993020887
p00023
Accepted
from math import hypot n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = hypot(xb - xa, yb - ya) if ra + rb < d: print(0) elif abs(ra - rb) <= d: print(1) elif rb < ra: print(2) else: print(-2)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s723589716
p00023
Accepted
import math num = int(input()) for i in range(num): lst = list(map(float, input().split())) xa, ya, ra = lst[0], lst[1], lst[2] xb, yb, rb = lst[3], lst[4], lst[5] d = math.sqrt((xa - xb)**2 + (ya - yb)**2) if ra + rb < d: print(0) elif d + min(ra, rb) < max(ra, rb): if ra < rb: print(-2) else: print(2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s921084919
p00023
Accepted
import sys readline = sys.stdin.readline write = sys.stdout.write EPS = 1e-9 def solve(): xa, ya, ra, xb, yb, rb = map(float, readline().split()) d = ((xa - xb)**2 + (ya - yb)**2)**.5 if d < rb - ra: write("-2\n") elif d < ra - rb: write("2\n") elif d > ra + rb: write("0\n") else: write("1\n") T = int(readline()) for i in range(T): solve()
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s265639422
p00023
Accepted
import math n = int(input()) for i in range(0,n): x1,y1,r1,x2,y2,r2 = (float(x) for x in input().split()) ans = 1 # Bが Aの中にあるとき2、 # AがBの中にあるとき-2、 # AとBが共有点をもつとき1、 # AとBが重なっていないとき0 # 円の中心からの距離 l = math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) if l < abs(r1 - r2): if r1 > r2: ans = 2 elif r2 > r1: ans = -2 if l > r1 + r2: ans = 0 print(ans)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s028303530
p00023
Accepted
import math n=int(input()) i=1 while n>=i: #終了条件 s=list(map(float,input().split())) #print("s",s) d=math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1])) #print("d",d) if d>s[2]+s[5]: #AとBが重なっていない print(0) elif abs(s[5]-s[2])<=d<=s[2]+s[5]: #AとBが共有点をもつ print(1) elif d<s[2]-s[5]: #BがAの中にある print(2) elif d<s[5]-s[2]: #AがBの中にある print(-2) i+=1
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s885620704
p00023
Accepted
n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = ((xa - xb) ** 2 + (ya - yb) ** 2)**(1/2) if d > ra + rb: print(0) else: if d + rb < ra: print(2) elif d + ra < rb: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s893105107
p00023
Accepted
for q in range(int(input())): xa, ya, ra, xb, yb, rb = map(float, input().split()) d2 = ((xb - xa) ** 2) + ((yb - ya) ** 2) if rb < ra and d2 < ((ra - rb) ** 2): print(2) elif ra < rb and d2 < ((rb - ra) ** 2): print(-2) elif ((ra + rb) ** 2) < d2: print(0) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s168892273
p00023
Accepted
N=int(input()) for i in range(N): x1,y1,r1,x2,y2,r2=map(float,input().split()) d=((x1-x2)**2+(y1-y2)**2)**0.5 if r1-r2>d: if r1==r2+d: print("1") else: print("2") elif r2-r1>d: if r2==r1+d: print("1") else: print("-2") elif d<r1+r2: print("1") elif r1+r2==d: print("1") elif d>r1+r2: print("0")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s911257347
p00023
Accepted
n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5 if rb < ra and d < ra - rb: print("2") elif ra < rb and d < rb - ra: print("-2") elif d <= ra + rb: print("1") else: print("0")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s319583041
p00023
Accepted
import math n = int(input()) for _ in range(n): x_a,y_a,r_a,x_b,y_b,r_b = map(float, input().split()) r_ab_plus = r_a + r_b r_ab_minus = abs(r_a-r_b) dist_center = math.sqrt((x_a-x_b)**2 + (y_a-y_b)**2) if dist_center < r_ab_minus and r_a > r_b: print(2) elif dist_center < r_ab_minus and r_b > r_a: print(-2) elif r_ab_minus <= dist_center and dist_center <= r_ab_plus: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s682804541
p00023
Accepted
n=int(input()) for i in range(n): x1,y1,r1,x2,y2,r2=map(float,input().split()) d=((x1-x2)**2+(y1-y2)**2)**0.5 r_min=min(r1,r2) r_max=max(r1,r2) if r_max>r_min+d: if r1>r2: print(2) else: print(-2) elif d<=r1+r2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s134082921
p00023
Accepted
n = int(input()) E = 10**-10 for i in range(n): xa,ya,ra,xb,yb,rb = [float(i) for i in input().split()] x = ((xb-xa)**2 + (yb-ya)**2)**0.5 xmax = x+rb xmin = x-rb if ra - xmax > E: print(2) elif xmin - (-ra) < -E: print(-2) elif xmin - ra > E: print(0) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s794023222
p00023
Accepted
for _ in range(int(input())): x1, y1, r1, x2, y2, r2 = [float(x) for x in input().split()] distance = ((x1 - x2)**2 + (y1 - y2)**2)**0.5 if distance > r1 + r2: print(0) else: if r1 > r2 and distance + r2 < r1: print(2) elif r1 < r2 and distance + r1 < r2: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s929062194
p00023
Accepted
n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) if xa - ra < xb - rb and xa + ra > xb + rb and ya - ra < yb - rb and ya + ra > yb + rb: print(2) elif xa - ra > xb - rb and xa + ra < xb + rb and ya - ra > yb - rb and ya + ra < yb + rb: print(-2) elif (xa - xb)**2 + (ya - yb)**2 <= (ra + rb)**2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s774552274
p00023
Accepted
import math def judge(dist, p, q): if p + q >= dist: if dist + p < q: ans.append(-2) elif dist + q < p: ans.append(2) else: ans.append(1) else: ans.append(0) N = int(input()) circles = [list(map(float, input().split())) for _ in range(N)] ans = [] for circle in circles: xa, ya, ra, xb, yb, rb = circle distance = math.sqrt((xa-xb)**2 + (ya-yb)**2) judge(distance, ra, rb) print('\n'.join(map(str, ans)))
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s465875091
p00023
Accepted
n = int(input()) for _ in range(n): xa,ya,ra,xb,yb,rb = map(float, input().split()) dr = ((xa-xb)**2+(ya-yb)**2)**0.5 if rb > (ra+dr): print(-2) continue elif ra > (rb+dr): print(2) continue elif dr > (ra+rb): print(0) continue else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s242252671
p00023
Accepted
import math from decimal import Decimal, getcontext getcontext().prec = 100 def solve(): N = int(input()) for _ in range(N): xa, ya, ra, xb, yb, rb = map(Decimal, input().split()) t = getcontext().power(xa - xb, Decimal('2')) + getcontext().power(ya - yb, Decimal('2')) D = t.sqrt() if ra > D + rb: print('2') elif rb > D + ra: print('-2') elif D <= ra + rb: print('1') else: print('0') if __name__ == "__main__": solve()
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s152052333
p00023
Runtime Error
while True: N=int(input()) for i in range(N): x1,y1,r1,x2,y2,r2=map(float,input().split()) d=((x1-x2)**2+(y1-y2)**2)**0.5 if r1-r2>d: if r1==r2+d: print("1") else: print("2") elif r2-r1>d: if r2==r1+d: print("1") else: print("-2") elif d<r1+r2: print("1") elif r1+r2==d: print("1") elif d>r1+r2: print("0")
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s397588582
p00023
Runtime Error
n=input() for i in xrange(n): xa,ya,ra,xb,yb,rb=map(int,raw_input().split()) d=(xa-xb)**2+(ya-yb)**2 if d>(ra+rb)**2: print(0) elif ra>rb: if (ra-rb)**2>d: print(2) else: print(1) else: if (rb-ra)**2>d: print(-2) else: print(1)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s843103869
p00023
Runtime Error
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
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s387926943
p00023
Runtime Error
#include <stdio.h> #include <math.h> int main(void){ int N; double Xa; double Ya; double Ra; double Xb; double Yb; double Rb; double distance; scanf("%d",&N); while(N--){ scanf("%lf%lf%lf%lf%lf%lf",&Xa,&Ya,&Ra,&Xb,&Yb,&Rb); distance = sqrt(pow(Xa - Xb,2.0) + pow(Ya - Yb,2.0)); if(distance + Rb - Ra <= 10E-14){ printf("2\n"); } else if(distance + Ra - Rb <= 10E-14){ printf("-2\n"); } else if(distance - Ra - Rb <= 10E-14){ printf("1\n"); } else{ printf("0\n"); } } return 0; }
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s116208847
p00023
Runtime Error
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 <= r1 + r2: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s650111539
p00023
Runtime Error
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)(ay * by) if d < abs(br - ar): if ar > br: print(2) else: print(-2) elif d <= ar + br: print(1) else: print(0)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s737825609
p00023
Runtime Error
from numpy import * N=int(input()) x_a=[0]*N y_a=[0]*N r_a=[0]*N x_b=[0]*N y_b=[0]*N r_b=[0]*N for i in range(N): x_a[i],y_a[i],r_a[i],x_b[i],y_b[i],r_b[i]=map(float,input().split()) for i in range(N): a=array([x_a[i]-x_b[i],y_a[i]-y_b[i]]) AB=linalg.norm(a) r_diff=abs(r_a[i]-r_b[i]) if AB > r_a[i]+r_b[i]: print(0) elif r_a[i]+r_b[i] >= AB and AB >= r_diff: print(1) elif r_diff > AB: if r_a[i] > r_b[i]: print(2) else: print(-2)
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
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> 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)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> 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:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 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 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>