s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s476913437
p00022
u067299340
1542183043
Python
Python3
py
Accepted
40
5712
202
while True: n = int(input()) if n == 0: break seq = [int(input()) for _ in range(n) ] for i in range(1, n): seq[i] = max(seq[i], seq[i - 1] + seq[i]) print(max(seq))
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,502
s863258994
p00022
u536245846
1538127678
Python
Python3
py
Accepted
40
5724
219
while True: t = int(input()) if t == 0: break tmp = [int(input()) for i in range(t)] res = [tmp[0]] for i in range(1,t): res.append(max(tmp[i], tmp[i]+res[i-1])) print(max(res))
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,503
s605102436
p00022
u219940997
1537454582
Python
Python3
py
Accepted
50
5712
206
while True: n = int(input()) if n == 0: break a, b = 0, -100000 num = [int(input()) for _ in range(n)] for n in num: a = max(a+n, n) b = max(a, b) print(b)
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,504
s413607383
p00022
u252700163
1534612302
Python
Python3
py
Accepted
40
5612
227
while True: n = int(input()) if n == 0: break res = -1111111111 s = 0 for i in range(n): a = int(input()) s = max(s + a, a) res = max(s, res) print(res)
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,505
s849587402
p00022
u319725914
1534228435
Python
Python3
py
Accepted
40
5604
197
while(True): n = int(input()) if n == 0: break r = -20000005 s = 0 for _ in range(n): a = int(input()) s = max(a+s,a) r = max(r,s) print(r)
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,506
s336900419
p00022
u079141094
1467469268
Python
Python3
py
Accepted
40
7704
255
# Maximum Sum Sequence n = int(input()) while not n == 0: cnd = [] cs = 0 for _ in range(n): if cs < 0 : cs = 0 cs += int(input()) cnd.append(cs) print(max(cnd)) try: n = int(input()) except EOFError: break
p00022
<H1>Maximum Sum Sequence</H1> <p> Given a sequence of numbers <var>a<sub>1</sub></var>, <var>a<sub>2</sub></var>, <var>a<sub>3</sub></var>, ..., <var>a<sub>n</sub></var>, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a <i>contiquous</i> subsequence. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each data set consists of: <pre> <var>n</var> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> . . <var>a<sub>n</sub></var> </pre> <p> You can assume that 1 &le; <var>n</var> &le; 5000 and -100000 &le; <var>a<sub>i</sub></var> &le; 100000. </p> <p> The input end with a line consisting of a single 0. </p> <H2>Output</H2> <p> For each dataset, print the maximum sum in a line. </p> <H2>Sample Input</H2> <pre> 7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0 </pre> <H2>Output for the Sample Input</H2> <pre> 19 14 1001 </pre>
7 -5 -1 6 4 9 -6 -7 13 1 2 3 2 -2 -1 1 2 3 2 1 -2 1 3 1000 -200 201 0
19 14 1001
7,507
s302002874
p00023
u193025715
1408268975
Python
Python3
py
Accepted
30
6788
440
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)
p00023
<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>
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
7,508
s257754719
p00023
u506132575
1416134012
Python
Python
py
Accepted
20
4308
364
#!/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
p00023
<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>
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
7,509
s780886508
p00023
u567380442
1423041219
Python
Python3
py
Accepted
30
6756
349
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)
p00023
<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>
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
7,510
s807311235
p00023
u744114948
1425999086
Python
Python3
py
Accepted
30
6836
301
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")
p00023
<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>
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
7,511
s208253989
p00023
u067299340
1433838156
Python
Python
py
Accepted
10
4284
188
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
p00023
<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>
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
7,512
s665799566
p00023
u873482706
1434538277
Python
Python
py
Accepted
10
4388
391
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()
p00023
<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>
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
7,513
s014955441
p00023
u379956761
1435071783
Python
Python3
py
Accepted
30
6836
369
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)
p00023
<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>
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
7,514
s640730979
p00023
u621997536
1435395387
Python
Python3
py
Accepted
30
6788
278
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)
p00023
<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>
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
7,515
s355801128
p00023
u071010747
1445265083
Python
Python3
py
Accepted
20
7660
484
# -*- 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()
p00023
<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>
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
7,516
s498794974
p00023
u489809100
1446543971
Python
Python
py
Accepted
10
6396
297
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
p00023
<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>
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
7,517
s984548165
p00023
u140201022
1446993227
Python
Python
py
Accepted
10
6488
253
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
p00023
<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>
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
7,518
s065608611
p00023
u529386725
1454766907
Python
Python3
py
Accepted
20
7520
303
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)
p00023
<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>
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
7,519
s835867288
p00023
u797673668
1456641990
Python
Python3
py
Accepted
20
7604
306
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
p00023
<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>
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
7,520
s473597021
p00023
u650459696
1458716582
Python
Python3
py
Accepted
30
7656
299
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')
p00023
<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>
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
7,521
s319449831
p00023
u148101999
1459237100
Python
Python
py
Accepted
10
6420
294
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"
p00023
<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>
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
7,522
s214783165
p00023
u130979865
1459948798
Python
Python
py
Accepted
10
6524
339
# -*- 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'
p00023
<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>
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
7,523
s290982800
p00023
u572790226
1460609797
Python
Python3
py
Accepted
20
7604
315
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')
p00023
<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>
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
7,524
s297419016
p00023
u766477342
1468114862
Python
Python3
py
Accepted
30
7628
332
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)
p00023
<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>
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
7,525
s541509824
p00023
u358919705
1471986994
Python
Python3
py
Accepted
20
7640
262
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)
p00023
<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>
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
7,526
s634810445
p00023
u379499530
1473122513
Python
Python
py
Accepted
10
6512
278
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
p00023
<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>
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
7,527
s074472619
p00023
u964040941
1479227063
Python
Python3
py
Accepted
20
7668
323
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)
p00023
<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>
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
7,528
s224783379
p00023
u922871577
1479427683
Python
Python
py
Accepted
30
7884
289
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
p00023
<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>
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
7,529
s600139381
p00023
u301729341
1481107503
Python
Python3
py
Accepted
20
7656
312
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)
p00023
<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>
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
7,530
s084327125
p00023
u252368621
1481341810
Python
Python3
py
Accepted
30
7652
312
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)
p00023
<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>
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
7,531
s327538076
p00023
u898097781
1483303452
Python
Python
py
Accepted
10
6468
297
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
p00023
<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>
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
7,532
s599370941
p00023
u711765449
1484463305
Python
Python3
py
Accepted
30
7672
405
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)
p00023
<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>
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
7,533
s306157849
p00023
u078042885
1485885127
Python
Python3
py
Accepted
20
7680
313
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())
p00023
<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>
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
7,534
s553547641
p00023
u078042885
1485885270
Python
Python3
py
Accepted
30
7752
296
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())
p00023
<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>
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
7,535
s430843939
p00023
u252414452
1486560540
Python
Python
py
Accepted
10
6420
436
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
p00023
<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>
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
7,536
s404519947
p00023
u032662562
1486603375
Python
Python3
py
Accepted
30
7688
404
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))
p00023
<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>
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
7,537
s507332457
p00023
u901080241
1488970524
Python
Python3
py
Accepted
20
7484
323
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)
p00023
<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>
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
7,538
s910666107
p00023
u462831976
1492722242
Python
Python3
py
Accepted
30
7712
521
# -*- 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)
p00023
<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>
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
7,539
s221486697
p00023
u462831976
1492722587
Python
Python3
py
Accepted
30
7720
522
# -*- 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)
p00023
<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>
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
7,540
s011355574
p00023
u462831976
1492722627
Python
Python3
py
Accepted
20
7596
514
# -*- 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)
p00023
<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>
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
7,541
s853368534
p00023
u618637847
1494903037
Python
Python3
py
Accepted
30
7532
370
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)
p00023
<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>
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
7,542
s284343006
p00023
u905313459
1496464194
Python
Python3
py
Accepted
30
7536
289
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")
p00023
<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>
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
7,543
s531158254
p00023
u957840591
1497914585
Python
Python3
py
Accepted
20
7660
473
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)
p00023
<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>
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
7,544
s313169123
p00023
u354053070
1501985955
Python
Python3
py
Accepted
20
7676
369
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)
p00023
<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>
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
7,545
s266458797
p00023
u187606290
1502736982
Python
Python3
py
Accepted
20
7616
800
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))
p00023
<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>
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
7,546
s933663068
p00023
u584777171
1503820457
Python
Python3
py
Accepted
30
7684
581
# ??????????????¢??¨????????????, ????????¢??? 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))
p00023
<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>
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
7,547
s242112663
p00023
u957021183
1504776801
Python
Python3
py
Accepted
30
7760
590
# 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))
p00023
<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>
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
7,548
s797579577
p00023
u811733736
1505372954
Python
Python3
py
Accepted
20
7752
655
# -*- 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:])
p00023
<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>
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
7,549
s133859072
p00023
u072398496
1507603524
Python
Python
py
Accepted
20
6500
252
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
p00023
<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>
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
7,550
s873718617
p00023
u236679854
1507673764
Python
Python3
py
Accepted
50
7740
322
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)
p00023
<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>
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
7,551
s969308401
p00023
u236679854
1507673859
Python
Python3
py
Accepted
20
7636
300
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)
p00023
<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>
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
7,552
s315627077
p00023
u928329738
1511854245
Python
Python3
py
Accepted
20
5620
388
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)
p00023
<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>
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
7,553
s760120339
p00023
u548155360
1512400359
Python
Python3
py
Accepted
20
5668
585
# 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
p00023
<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>
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
7,554
s189131538
p00023
u203261375
1513087212
Python
Python3
py
Accepted
30
5644
309
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')
p00023
<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>
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
7,555
s342001263
p00023
u299798926
1513231209
Python
Python3
py
Accepted
20
5664
310
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)
p00023
<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>
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
7,556
s643046833
p00023
u024715419
1515643127
Python
Python3
py
Accepted
20
5664
307
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")
p00023
<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>
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
7,557
s204579079
p00023
u764789069
1516116142
Python
Python
py
Accepted
10
4712
257
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
p00023
<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>
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
7,558
s093042757
p00023
u150984829
1516985907
Python
Python3
py
Accepted
20
5648
146
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])
p00023
<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>
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
7,559
s327538347
p00023
u150984829
1516986190
Python
Python3
py
Accepted
20
5656
137
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])
p00023
<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>
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
7,560
s685818836
p00023
u166871988
1523773332
Python
Python3
py
Accepted
20
5668
217
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)])
p00023
<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>
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
7,561
s512755526
p00023
u724548524
1525850917
Python
Python3
py
Accepted
20
5668
293
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)
p00023
<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>
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
7,562
s077872634
p00023
u043254318
1526485518
Python
Python3
py
Accepted
20
5672
415
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)
p00023
<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>
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
7,563
s378250341
p00023
u197615397
1528798868
Python
Python3
py
Accepted
20
5664
285
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)
p00023
<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>
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
7,564
s792642502
p00023
u847467233
1529129271
Python
Python3
py
Accepted
30
5604
321
# 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)
p00023
<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>
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
7,565
s664435670
p00023
u724947062
1347284871
Python
Python
py
Accepted
10
5396
511
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)
p00023
<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>
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
7,566
s779976900
p00023
u647766105
1354692931
Python
Python
py
Accepted
20
4296
204
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
p00023
<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>
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
7,567
s525916168
p00023
u419407022
1356119171
Python
Python
py
Accepted
10
23000
301
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
p00023
<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>
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
7,568
s875103890
p00023
u560838141
1357517704
Python
Python
py
Accepted
10
4404
513
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)
p00023
<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>
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
7,569
s315910059
p00023
u782850731
1362237254
Python
Python
py
Accepted
10
4416
483
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)))
p00023
<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>
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
7,570
s138023199
p00023
u310778860
1363075226
Python
Python
py
Accepted
30
5900
443
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
p00023
<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>
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
7,571
s960080173
p00023
u282635979
1363523625
Python
Python
py
Accepted
10
4440
444
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
p00023
<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>
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
7,572
s661427330
p00023
u542421762
1368261347
Python
Python
py
Accepted
10
4432
774
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)
p00023
<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>
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
7,573
s573146169
p00023
u912237403
1378016380
Python
Python
py
Accepted
10
4432
243
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
p00023
<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>
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
7,574
s294006803
p00023
u912237403
1378016613
Python
Python
py
Accepted
10
4296
224
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
p00023
<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>
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
7,575
s803561026
p00023
u454358619
1378183798
Python
Python
py
Accepted
10
4408
513
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)
p00023
<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>
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
7,576
s918876641
p00023
u813384600
1380541515
Python
Python
py
Accepted
20
4252
412
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
p00023
<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>
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
7,577
s055729599
p00023
u523886269
1381540949
Python
Python
py
Accepted
20
4404
398
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
p00023
<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>
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
7,578
s160252783
p00023
u633068244
1393385003
Python
Python
py
Accepted
10
4384
373
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
p00023
<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>
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
7,579
s522221155
p00023
u912237403
1394289351
Python
Python
py
Accepted
10
4292
219
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
p00023
<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>
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
7,580
s407429695
p00023
u708217907
1398687487
Python
Python
py
Accepted
10
4392
339
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
p00023
<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>
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
7,581
s770902487
p00023
u703161091
1400126566
Python
Python3
py
Accepted
30
6836
360
# 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)
p00023
<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>
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
7,582
s620266537
p00023
u491763171
1401139967
Python
Python
py
Accepted
10
4368
282
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
p00023
<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>
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
7,583
s993020887
p00023
u436634575
1401144521
Python
Python3
py
Accepted
30
6820
293
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)
p00023
<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>
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
7,584
s723589716
p00023
u187074069
1594216741
Python
Python3
py
Accepted
20
5672
408
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)
p00023
<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>
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
7,585
s921084919
p00023
u260980560
1589608547
Python
Python3
py
Accepted
20
5656
403
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()
p00023
<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>
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
7,586
s265639422
p00023
u630911389
1583595210
Python
Python3
py
Accepted
20
5672
543
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)
p00023
<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>
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
7,587
s028303530
p00023
u472768263
1570448244
Python
Python3
py
Accepted
20
5660
687
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
p00023
<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>
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
7,588
s885620704
p00023
u824708460
1568085726
Python
Python3
py
Accepted
20
5640
318
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)
p00023
<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>
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
7,589
s893105107
p00023
u511231264
1566344429
Python
Python3
py
Accepted
20
5612
330
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)
p00023
<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>
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
7,590
s168892273
p00023
u647694976
1564455144
Python
Python3
py
Accepted
20
5644
428
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")
p00023
<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>
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
7,591
s911257347
p00023
u506537276
1560159229
Python
Python3
py
Accepted
20
5640
290
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")
p00023
<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>
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
7,592
s319583041
p00023
u625806423
1557134107
Python
Python3
py
Accepted
20
5672
429
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)
p00023
<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>
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
7,593
s682804541
p00023
u990228206
1553160012
Python
Python3
py
Accepted
20
5644
320
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)
p00023
<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>
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
7,594
s134082921
p00023
u563075864
1542802739
Python
Python3
py
Accepted
20
5656
284
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)
p00023
<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>
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
7,595
s794023222
p00023
u067299340
1542185197
Python
Python3
py
Accepted
20
5652
366
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)
p00023
<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>
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
7,596
s929062194
p00023
u717526540
1541663877
Python
Python3
py
Accepted
20
5616
414
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)
p00023
<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>
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
7,597
s774552274
p00023
u219940997
1537455313
Python
Python3
py
Accepted
20
5688
497
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)))
p00023
<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>
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
7,598
s465875091
p00023
u319725914
1534231040
Python
Python3
py
Accepted
20
5644
324
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)
p00023
<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>
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
7,599
s242252671
p00023
u079141094
1516619406
Python
Python3
py
Accepted
30
6472
556
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()
p00023
<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>
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
7,600
s473210902
p00024
u352394527
1530881617
Python
Python3
py
Accepted
20
5636
163
import math while True: try: v = float(input()) print(math.ceil(v ** 2 / 19.6 / 5) + 1) #print(v ** 2 / 19.6 // 5 + 2) except EOFError: break
p00024
<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>Physical Experiments</H1> <p> Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/> <br/> $ v = 9.8 t $<br/> $ y = 4.9 t^2 $<br/> </p> <!-- <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center> --> <p> A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment. </p> <p> You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 &lt; <i>v</i> &lt 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. The input ends with EOF. The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the lowest possible floor where the ball cracks. </p> <H2>Sample Input</H2> <pre> 25.4 25.4 </pre> <H2>Output for the Sample Input</H2> <pre> 8 8 </pre>
25.4 25.4
8 8
7,601