submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s918833638
p00022
Runtime Error
# coding: utf-8 # Your code here! n=int(input()) while n!=0: for i in range(n): list[i]=int(input()) a=0 b=0 for i in range(n): for j in range(n-i): a+=list[i+j] if b<a: b=a print a n=int(input())
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
<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>
s695595799
p00022
Runtime Error
# coding: utf-8 # Your code here! n=int(input()) while n!=0: for i in range(n): list[i]=int(input()) a=0 b=0 for i in range(n): for j in range(n-i): a+=list[i+j] if b<a: b=a print a n=int(input()),
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
<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>
s178393161
p00022
Runtime Error
# coding: utf-8 # Your code here! n=int(input()) while n!=0: for i in range(n): list.append(int(input())) a=0 b=0 for i in range(n): for j in range(n-i): a+=list[i+j] if b<a: b=a print a n=int(input())
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
<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>
s535236848
p00022
Runtime Error
# coding: utf-8 # Your code here! n=int(raw_input()) while n!=0: for i in range(n): list.append(int(raw_input())) a=0 b=0 for i in range(n): for j in range(n-i): a+=list[i+j] if b<a: b=a print a n=int(input())
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
<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>
s952561968
p00022
Runtime Error
while True: n = int(input()) if n == 0: break a = [int(input()) for _ in range(n)] d = [a[0]] for i in range(1, n): if a[i] / d[-1] >= 0: d[-1] += a[i] else: d.append(a[i]) for i in range(2, len(d)): if d[i - 1] < 0 and d[i -2] > d[i - 1] and d[i] > d[i - 1]: d[i] += d[i -2] + d[i -1] print(max(d))
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
<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>
s714445896
p00022
Runtime Error
while True: n = int(input()) if n == 0: break a = [int(input()) for _ in range(n)] d = [a[0]] for i in range(n): if d[0] == 0: d[0] += a[i] if a[i] / d[-1] >= 0: d[-1] += a[i] else: d.append(a[i]) for i in range(2, len(d)): if d[i - 1] < 0 and d[i -2] > d[i - 1] and d[i] > d[i - 1]: d[i] += d[i -2] + d[i -1] print(max(d))
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
<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>
s215023619
p00022
Runtime Error
while True: n = int(input()) if n == 0: break a = [int(input()) for _ in range(n)] d = [a[0]] for i in range(n): if d[0] == 0: d[0] += a[i] elif a[i] / d[-1] >= 0: d[-1] += a[i] else: d.append(a[i]) if d[0] < 0: d.pop(0) print(d) if len(d) <= 2: print(max(d)) else: maxd = max(d) for i in range(0, len(d), 2): for j in range(i + 1, len(d) + 1, 2): print("{} {} {}".format(i, j, sum(d[i:j]))) maxd = max(maxd, sum(d[i:j])) print(maxd)
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
<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>
s716384175
p00022
Runtime Error
while True: n = int(input()) if n == 0: break a = [int(input()) for _ in range(n)] d = [a[0]] for i in range(n): if d[0] == 0: d[0] += a[i] elif a[i] / d[-1] >= 0: d[-1] += a[i] else: d.append(a[i]) if d[0] < 0: d.pop(0) if d == []: print(max(a)) if len(d) <= 2: print(max(d)) else: maxd = max(d) for i in range(0, len(d), 2): for j in range(i + 1, len(d) + 1, 2): maxd = max(maxd, sum(d[i:j])) print(maxd)
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
<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>
s131246509
p00022
Runtime Error
while True: n = int(input()) if n == 0: break a = [int(input()) for _ in range(n)] d = [a[0]] for i in range(n): if d[0] == 0: d[0] += a[i] elif a[i] / d[-1] >= 0: d[-1] += a[i] else: d.append(a[i]) if len(d) <= 2: print(max(max(d), max(a)) else: if d[0] < 0: d.pop(0) maxd = max(d) for i in range(0, len(d), 2): for j in range(i + 1, len(d) + 1, 2): maxd = max(maxd, sum(d[i:j])) print(maxd)
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
<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>
s370874071
p00022
Runtime Error
from collections import deque while True: n = int(input()) if n == 0:break a = [int(input()) for _ in range(n)] b = deque([0] * n) j = 0 for i in range(n): if a[i] * b[j] >= 0:b[j] += a[i] else:j += 1;b[j] += a[i] if b[0] < 0:b.popleft() while b[-1] <= 0:b.pop() m = len(b) // 2 + 1 v = [[0] * m for _ in range(m)] v[0][0] = b[0] for i in range(1, m): v[0][i] = v[0][i - 1] + b[2 * i] + b[2 * i - 1] for i in range(1, m): for j in range(i, m): v[i][j] = v[i - 1][j] - b[2 * i - 2] - b[2 * i - 1] print(max([max(i) for i in v]))
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
<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>
s196866987
p00022
Runtime Error
from collections import deque while True: n = int(input()) if n == 0:break a = [int(input()) for _ in range(n)] b = deque([0] * n) j = 0 for i in range(n): if a[i] * b[j] >= 0:b[j] += a[i] else:j += 1;b[j] += a[i] if b[0] < 0:b.popleft() while b[-1] <= 0 and len(b) > 1:b.pop() m = len(b) // 2 + 1 v = [[0] * m for _ in range(m)] v[0][0] = b[0] for i in range(1, m): v[0][i] = v[0][i - 1] + b[2 * i] + b[2 * i - 1] for i in range(1, m): for j in range(i, m): v[i][j] = v[i - 1][j] - b[2 * i - 2] - b[2 * i - 1] print(max([max(i) for i in v]))
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
<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>
s955233371
p00022
Runtime Error
def inc(x): return x+1 while True: n = int(raw_input()) if n == 0: break numbers = [int(raw_input()) for i in range(n)] pointers = filter(lambda x:x[0]<x[1], map(lambda x:(x/n,x%n+1),xrange(n*n))) ans = 0 for pointer in pointers: tmp = reduce(lambda x,y:x+y,numbers[pointer[0],pointer[1]]) ans = tmp > ans if tmp else ans print ans
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
<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>
s201655143
p00022
Runtime Error
while True: n = int(raw_input()) if n == 0: break numbers = [int(raw_input()) for i in range(n)] if max(numbers) <= 0: return max(numbers) ans = 0 for i in range(n): tmp = 0 for j in range(i,n): tmp += numbers[j] ans = max(ans,tmp) print ans
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
<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>
s508758618
p00022
Runtime Error
from __future__ import (absolute_import, division, print_function, unicode_literals) from sys import stdin while True: n = int(stdin.readline()) if not n: break tup = tuple(int(stdin.readline()) for _ in xrange(n)) L = [tup[0]] for i in tup[1:]: if 0 > i and 0 > L[-1]: L[-1] += i elif 0 <= i and 0 <= L[-1]: L[-1] += i else: L.append(i) while True: length = len(L) if L[0] <= 0: L.pop(0) continue if L[-1] <= 0: L.pop() continue if length > 1 and L[0] + L[1] <= 0: L.pop(0) L.pop(0) continue if length > 1 and L[-1] + L[-2] <= 0: L.pop() L.pop() continue if length > 2 and sum(L[:3]) >= L[2]: L[2] = sum(L[:3]) L.pop(0) L.pop(0) continue if length > 2 and sum(L[-3:]) >= L[-3]: L[-3] = sum(L[-3:]) L.pop(0) L.pop(0) continue break m = 0 for i in xrange(len(L)): for j in xrange(1 + i, len(L) + 1): t = sum(L[i:j]) if t > m: m = t print(m)
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
<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>
s272011371
p00022
Runtime Error
from __future__ import (division, absolute_import, print_function, unicode_literals) from sys import stdin def grouping(nums): it = iter(nums) L = [next(nums)] minus = L[0] < 0 for n in it: if (n < 0 and minus) or (n >= 0 and not minus): L[-1] += n else: L.append(n) minus = not minus return L def collect(nl): result = 0 while len(nl) > 1: nl = grouping(nl[i] + nl[i+1] for i in xrange(0, len(nl), 2)) if nl[-1] <= 0: nl.pop() if not len(nl): break if nl[0] >= 0: result += nl[0] nl.pop(0) return result while True: n = int(stdin.readline()) if not n: break L = grouping(int(stdin.readline()) for _ in xrange(n)) if L[0] <= 0: L.pop(0) if L[-1] <= 0: L.pop() val = max(L) idx = L.index(val) val += collect(list(reversed(L[:idx]))) val += collect(L[idx+1:]) print(val)
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
<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>
s703588998
p00022
Runtime Error
while True: n = input() if n == 0: break else: nums = [] for val in range(1,n+1): nums.append(input()) sums = [] for val in range(0,n): sums.append(nums[val]+nums[val+1]) sums.sort() sums.reverse() print sums[0] continue
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
<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>
s369811623
p00022
Runtime Error
while True: n = input() if n == 0: break else: nums = [] for val in range(1,n+1): num = int(raw_input()) nums.append(num) sums = [] for val in range(0,n-1): sums.append(nums[val]+nums[val+1]) sums.sort() sums.reverse() print sums[0] continue
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
<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>
s777695125
p00022
Runtime Error
while True: n = input() if n == 0: break else: nums = [] for val in range(1,n+1): num = int(raw_input()) nums.append(num) sums = [] for val in range(1,n): sums.append(nums[val-1]+nums[val]) sums.sort() sums.reverse() print sums[0] continue
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
<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>
s019858246
p00022
Runtime Error
import sys def max_sum_seq(lis): r = [] l = len(lis) for n in range(1, l+1): r = r + every_slice(lis, n) return max(map((lambda r1: reduce((lambda x, y: x + y), r1, 0)), r)) def every_slice(lis, n): r = [] l = len(lis) for i in range(l-n+1): r.append(lis[i:i+n]) return r #input_file = open(sys.argv[1], "r") while True: # n = int(input_file.readline()) n = int(sys.stdin.readline()) if n == 0: break lis = [] for i in range(n): lis.append(int(input_file.readline())) print max_sum_seq(lis)
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
<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>
s258608323
p00022
Runtime Error
----:---F1 *scratch* All L1 (Fundamental)------------------------------------------------------------------------------------ Loading subst-jis...done while True: n = int(raw_input()) if n == 0: break a=[] for i in range(n): a[i] = int(raw_input()) max = -1e10 for i in range(len(a)): sum = 0 for j in range(i+1:len(a)): sum += a[j] if sum > max: max = sum print max
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
<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>
s069435175
p00023
Wrong Answer
import math n = int(input()) for _ in range(n): xa,ya,ra,xb,yb,rb = map(float, input().split()) len=math.sqrt((xa-xb)**2+(ya-yb)**2) if len + rb <= ra: print("2") elif len < ra + rb: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s443367499
p00023
Wrong Answer
import math n = int(input()) for _ in range(n): xa,ya,ra,xb,yb,rb = map(float, input().split()) len=math.sqrt((xa-xb)**2+(ya-yb)**2) if len + rb <= ra: print("2") elif len <= ra + rb: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s885929156
p00023
Wrong Answer
import math n = int(input()) for _ in range(n): xa,ya,ra,xb,yb,rb = map(float, input().split()) len=math.sqrt((xa-xb)**2+(ya-yb)**2) if len + rb <= ra: print("2") elif len + ra <= rb: print("-2") elif len <= ra + rb: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s005091172
p00023
Wrong Answer
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]: d=(a-c)**2+(b-d)**2 if d>(r+s)**2:print 0 elif d+min(r,s)>max(r,s):print 1 elif r>s:print 2 else:print -2
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s404352631
p00023
Wrong Answer
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]: d=(a-c)**2+(b-d)**2 if d>(r+s)**2:print 0 elif d+min(r*r,s*s)>max(r*r,s*s):print 1 elif r>s:print 2 else:print -2
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s945404188
p00023
Wrong Answer
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]: d=((a-c)**2+(b-d)**2)**0.5 if d>(r+s):print 0 elif d+min(r,s)>max(r,s):print 1 elif r>s:print 2 else:print -2
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s790081641
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2) if distance < ra + rb: if distance + ra < rb or distance + rb < ra: print("2") else: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s054307587
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2) if distance < ra + rb: if (ra < rb and distance < ra) or (ra > rb and distance < rb): print("2") else: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s796546637
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt(abs(xa-xb)**2 + abs(ya-yb)**2) if distance < ra + rb: if (ra < rb and distance + ra < rb) or (ra > rb and distance + rb < ra): print("2") else: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s229966372
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt((xa-xb)**2 + (ya-yb)**2) if distance < ra + rb: if (ra < rb and distance + ra < rb) or (ra > rb and distance + rb < ra): if ra < rb: print("-2") else: print("2") else: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s999323619
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt((xa-xb)**2 + (ya-yb)**2) if ra + rb < distance: if (ra < rb and distance + ra < rb): print(-2) elif (rb < ra and distance + rb < ra): print(2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s297964980
p00023
Wrong Answer
import sys import math n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt((xa-xb)**2 + (ya-yb)**2) if ra + rb > distance: if (ra < rb and distance + ra < rb): print(-2) elif (rb < ra and distance + rb < ra): print(2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s487803504
p00023
Wrong Answer
n=int(raw_input()) for i in range(n): xa,ya,ra,xb,yb,rb=map(float,raw_input().split()) d=((xa-xb)**2+(ya-yb)**2)**0.5 if ra+rb<d: print 0 elif ra>rb: print 2 elif ra<rb: print -2 else: print 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s233207743
p00023
Wrong Answer
import sys,math cases = int(input()) i = 0 while i < cases: for line in sys.stdin.readlines(): xa , ya , ra , xb , yb , rb = map(float,line.split()) dist = (yb - ya)*(yb - ya) + (xb - xa)*(xb - xa) dist = math.sqrt(dist) print(dist) if (ra < rb and dist == 0): print("-2") elif (rb < ra and dist == 0): print("2") elif dist < ra + rb: print("1") elif dist > ra + rb : print("0") i += 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s965571461
p00023
Wrong Answer
import sys,math cases = int(input()) i = 0 while i < cases: for line in sys.stdin.readlines(): xa , ya , ra , xb , yb , rb = map(float,line.split()) dist = (yb - ya)*(yb - ya) + (xb - xa)*(xb - xa) dist = math.sqrt(dist) if (ra < rb and dist == 0): print("-2") elif (rb < ra and dist == 0): print("2") elif (ra - rb or rb - ra) < dist < ra + rb: print("1") elif dist > ra + rb : print("0") i += 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s425536084
p00023
Wrong Answer
from math import sqrt num = int(input()) for _ in range(num): xa, ya, ra, xb, yb, rb = [float(el) for el in input().split(' ')] d = sqrt((xa-xb)**2 + (ya-yb)**2) if d < ra + rb: if ra > rb and d < ra - rb: print(2) elif rb > ra and d < rb -ra: print(-2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s524325961
p00023
Wrong Answer
for _ in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float,input().split())) dAB = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5 if ra + rb < dAB: print('0') elif dAB + rb < ra: print('2') elif dAB + ra < rb: print('-1') else: print('1')
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s986874848
p00023
Wrong Answer
#encoding=utf-8 x = input() for i in xrange(x): x1,y1,r1,x2,y2,r2 = map(float, raw_input().split()) tag1 = (x1 - x2)**2 + (y1 - y2)**2 tag2 = (r1 - r2)**2 if tag1 <= tag2: tag3 = (r1 - (2/r2))**2 tag4 = ((2/r1) - r2)**2 if tag1 <= tag3 or tag1 <= tag4: if r1 > r2: print "2" else: print "-2" else: print "1" else: print "0"
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s738015237
p00023
Wrong Answer
import math x = input() for i in xrange(x): x1,y1,r1,x2,y2,r2 = map(float, raw_input().split()) d = math.sqrt((x1 - x2)**2 + (y1 - y2)**2) if d <= r1 - r2: print "2" elif d <= r2 - r1: print "-2" elif r1 - r2 <= d and d <= r1 + r2: print "1" elif r2 - r1 <= d and d <= r1 + r2: print "1" else: print "0"
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s391289718
p00023
Wrong Answer
# -*- coding: utf-8 -*- import math n = int(raw_input()) for i in range(n): x1, y1, r1, x2, y2, r2 = map(float, raw_input().split()) d = math.sqrt(math.pow(x2-x1, 2) + math.pow(y2-y1, 2)) if r2+d <= r1: print '2' elif r1+d <= r2: print '-2' elif r1+r2 >= d: print '1' else: print '0'
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s695408269
p00023
Wrong Answer
import math for i in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) d1 = math.sqrt((xa - xb) ** 2 + (ya - yb) ** 2) d2 = math.fabs(ra + rb) if d1 <= d2: if d1 <= ra or d1 <= rb: print(2 if ra > rb else -2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s594644708
p00023
Wrong Answer
import math for i in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) d1 = math.sqrt((xa - xb) ** 2 + (ya - yb) ** 2) d2 = math.fabs(ra + rb) if d1 <= d2: if d1 < ra or d1 < rb: print(2 if ra > rb else -2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s028676556
p00023
Wrong Answer
import math for i in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) d1 = (xa - xb) ** 2 + (ya - yb) ** 2 d2 = ra ** 2 + rb ** 2 dr = ra ** 2 - rb ** 2 if d1 <= d2: if math.fabs(dr) > math.fabs(d1): print(2 if ra > rb else -2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s040795031
p00023
Wrong Answer
import math for i in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) d1 = (xa - xb) ** 2 + (ya - yb) ** 2 d2 = ra ** 2 + rb ** 2 dr = (ra-rb) ** 2 if d1 <= d2: if d2 > d1 > dr: print(1) elif dr > d1: print(2 if ra > rb else -2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s505491395
p00023
Wrong Answer
import math for i in range(int(input())): xa, ya, ra, xb, yb, rb = list(map(float, input().split())) d1 = (xa - xb) ** 2 + (ya - yb) ** 2 d2 = ra ** 2 + rb ** 2 dr = (ra-rb) ** 2 if d1 <= d2: if dr >= d1: print(2 if ra > rb else -2) else: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s652511784
p00023
Wrong Answer
import math n = input() for i in xrange(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) d = math.sqrt(((xa - xb) ** 2) + ((ya - yb) ** 2)) if ra + rb <= d: print 0 elif ra + rb > d and math.fabs(ra - rb) < d: print 1 else: if ra > rb: print 2 else: print -2
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s462296724
p00023
Wrong Answer
from fractions import Fraction as F for _ in xrange(input()): x1, y1, r1, x2, y2, r2 = map(F, raw_input().split()) d = (x1+x2)**2+(y1+y2)**2 if d < (r1-r2)**2: print 2 if r1 > r2 else -2 elif (r1-r2)**2 <= d <= (r1+r2)**2: print 1 else: print 0
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s422191654
p00023
Wrong Answer
n = int(input()) for i in range(n): xa,ya,ra,xb,yb,rb = map(float,input().split()) if (xa - xb)**2 + (ya - yb)**2 > (ra + rb)**2: print(0) elif rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2: print(-2) elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2: print(2) elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s284497703
p00023
Wrong Answer
n = int(input()) for i in range(n): xa,ya,ra,xb,yb,rb = map(float,input().split()) if (xa - xb)**2 + (ya - yb)**2 > (ra + rb)**2: print("0") elif rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2: print("-2") elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2: print("2") elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2: print("1")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s132634841
p00023
Wrong Answer
n = int(input()) for i in range(n): xa,ya,ra,xb,yb,rb = map(float,input().split()) if rb > ra and (xa - xb)**2 + (ya - yb)**2 < (rb - ra)**2: print("-2") elif ra > rb and (xa - xb)**2 + (ya - yb)**2 < (ra - rb)**2: print("2") elif (ra - rb)**2 < (xa - xb)**2 + (ya - yb)**2 < (ra + rb)**2: print("1") else: print("0")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s366445569
p00023
Wrong Answer
n = int(input()) for i in range(n): xa,ya,ra,xb,yb,rb = map(float,input().split()) dis = (xa - xb)**2 + (ya - yb)**2 if dis > (ra + rb)**2: print(0) elif rb > ra and dis < (rb - ra)**2: print(-2) elif ra > rb and dis < (ra - rb)**2: print(2) elif (ra - rb)**2 < dis < (ra + rb)**2: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s425499390
p00023
Wrong Answer
import math n = int(raw_input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' ')) d = math.sqrt((xa-xb)**2 + (ya-yb)**2) if d+rb <= ra: print 2 elif d+ra <= rb: print -2 elif d > ra+rb: print 0 else: print 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s114894481
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb - distance > 10E-8: # B in A print(2) elif Rb - Ra - distance > 10E-8: # A in B print(-2) elif Ra + Rb - distance > 10E-8: # Intersect print(1) elif Ra + Rb - distance < 10E-8: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s576636710
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb - distance > 10E-8: # B in A print(2) elif Rb - Ra - distance > 10E-8: # A in B print(-2) elif Ra + Rb - distance > 10E-8: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s418322105
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb > distance: # B in A print(2) elif Rb - Ra > distance: # A in B print(-2) elif Ra + Rb > distance: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s788415094
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra > Rb + distance: # B in A print(2) elif Rb > Ra + distance: # A in B print(-2) elif Ra + Rb > distance: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s513479341
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): #[Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] [Xa,Ya,Ra,Xb,Yb,Rb] = map(float,input().split()) distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb > distance: # B in A print(2) elif Rb - Ra > distance: # A in B print(-2) elif Ra + Rb > distance: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s005545668
p00023
Wrong Answer
import math N = eval(input()) while N != 0: [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb > distance: # B in A print(2) elif Rb - Ra > distance: # A in B print(-2) elif Ra + Rb > distance: # Intersect print(1) else: # Not overlap print(0) N -= 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s991906787
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if abs(Ra - Rb - distance) > 10E-8: # B in A print(2) elif abs(Rb - Ra - distance) > 10E-8: # A in B print(-2) elif abs(Ra + Rb - distance) > 10E-8: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s436510026
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb - distance > -10E-8: # B in A print(2) elif Rb - Ra - distance > -10E-8: # A in B print(-2) elif Ra + Rb - distance > -10E-8: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s515401113
p00023
Wrong Answer
import math N = eval(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb - distance > -10E-16: # B in A print(2) elif Rb - Ra - distance > -10E-16: # A in B print(-2) elif Ra + Rb - distance > -10E-16: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s946199844
p00023
Wrong Answer
import math N = int(input()) for _ in range(N): [Xa,Ya,Ra,Xb,Yb,Rb] = [float(element) for element in input().split()] distance = math.sqrt((Xa - Xb)**2 + (Ya - Yb)**2) # Compute distance from point A to point B if Ra - Rb - distance > -10E-16: # B in A print(2) elif Rb - Ra - distance > -10E-16: # A in B print(-2) elif Ra + Rb - distance > -10E-16: # Intersect print(1) else: # Not overlap print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s612940892
p00023
Wrong Answer
import math def check_intersect(x1,y1,r1,x2,y2,r2): d = math.sqrt((x2-x1)**2 + (y2-y1)**2) if d >= r1+r2: print(0) elif d + r1 <= r2: print(-2) elif d + r2 <= r1: print(2) elif d <= r1*r2: print(1) return 0 n = int(input()) for i in range(n): x1,y1,r1,x2,y2,r2 = map(float,input().split()) check_intersect(x1,y1,r1,x2,y2,r2)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s636248461
p00023
Wrong Answer
import math def check_intersect(x1,y1,r1,x2,y2,r2): d = math.sqrt((x2-x1)**2 + (y2-y1)**2) if d >= r1+r2: print(0) elif d + r1 <= r2: print(-2) elif d + r2 <= r1: print(2) elif d <= r1+r2: print(1) return 0 n = int(input()) for i in range(n): x1,y1,r1,x2,y2,r2 = map(float,input().split()) check_intersect(x1,y1,r1,x2,y2,r2)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s594121183
p00023
Wrong Answer
import math def check_intersect(x1,y1,r1,x2,y2,r2): d = math.sqrt((x2-x1)**2 + (y2-y1)**2) if d > r1+r2: print(0) elif d + r1 <= r2: print(-2) elif d + r2 <= r1: print(2) elif d <= r1+r2: print(1) return 0 n = int(input()) for i in range(n): x1,y1,r1,x2,y2,r2 = map(float,input().split()) check_intersect(x1,y1,r1,x2,y2,r2)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s117084256
p00023
Wrong Answer
import math def check_intersect(x1,y1,r1,x2,y2,r2): d = math.sqrt((x2-x1)**2 + (y2-y1)**2) if r1 < r2 and d + r1 <= r2: print(-2) elif r1 > r2 and d + r2 <= r1: print(2) elif d > r1+r2: print(0) elif d <= r1+r2: print(1) return 0 n = int(input()) for i in range(n): x1,y1,r1,x2,y2,r2 = map(float,input().split()) check_intersect(x1,y1,r1,x2,y2,r2)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s047812315
p00023
Wrong Answer
import math num = int(input()) for i in range(num): ax,ay,ar,bx,by,br = map(float,input().split(' ')) d = (ax - bx)*(ax - bx) + (ay * by) if d < (br - ar): print(2) if d < (ar - br): print(-2) elif d <= (ar + br): print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s306795269
p00023
Wrong Answer
import math num = int(input()) for i in range(num): ax,ay,ar,bx,by,br = map(float,input().split(' ')) d = (ax - bx)*(ax - bx) + (ay * by) if d < (ar - br): print(2) if d < (br - ar): print(-2) elif d <= (ar + br): print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s247145139
p00023
Wrong Answer
import math num = int(input()) for i in range(num): ax,ay,ar,bx,by,br = map(float,input().split(' ')) d = (ax - bx)*(ax - bx) + (ay * by) if d < abs(br - ar): if ar > br: print(2) else: print(-2) elif d <= ar + br: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s571426162
p00023
Wrong Answer
import math num = int(input()) for i in range(num): ax,ay,ar,bx,by,br = map(float,input().split(' ')) d = (ax - bx)**2 + (ay * by)**2 if d < abs(br - ar): if ar > br: print(2) else: print(-2) elif d <= ar + br: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s286489685
p00023
Wrong Answer
n = input() for i in range(int(n)): xa, ya, ra, xb, rb, yb = list(map(float, input().split(" "))) d = abs(complex(xb-xa, yb-ya)) if ra + rb < d: print("0") elif abs(rb-ra) <= d <= ra+rb: print("1") elif d < abs(ra-rb): print("2" if ra > rb else "-2")
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s538972668
p00023
Wrong Answer
# ??????????????¢??¨????????????, ????????¢??? def plus(a, b): return a + b def minus(a, b): return abs(a - b) def distance(x1, y1, x2, y2): r2 = (x1 - x2)**2 + (y1 - y2)**2 return pow(r2, 0.5) def flag(l): rp = plus(l[2], l[5]) rm = minus(l[2], l[5]) d = distance(l[0], l[1], l[3], l[4]) if rp < d: return 0 elif d < rm: return 2 else: return 1 N = int(input()) for i in range(N): a = list(map(float, input().split())) print(flag(a))
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s888826502
p00023
Wrong Answer
import math n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2) if d < ra - rb: print(2) elif d < rb - ra: print(-2) elif abs(rb - ra) < d and d < ra + rb: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s750065104
p00023
Wrong Answer
for i in range(int(input())): points = input().split() p = list(map(float,points)) if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= p[2]**2: print(2) elif (p[0]-p[3])**2 + (p[1]-p[4])**2 < p[5]**2: print(-2) elif (p[3]-p[0])**2 + (p[4]-p[1])**2 < (p[2]+p[5])**2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s008316601
p00023
Wrong Answer
for i in range(int(input())): points = input().split() p = list(map(float,points)) if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= p[2]**2: print(2) elif (p[0]-p[3])**2 + (p[1]-p[4])**2 <= p[5]**2: print(-2) elif (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]+p[5])**2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s891771978
p00023
Wrong Answer
n=int(input()) for i in range(n): points = input().split() p = list(map(float,points)) if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]-p[5])**2: if p[5]>p[2]: print(-2) else: print(2) elif (p[0]-p[3])**2 + (p[1]-p[4])**2 > (p[2]-p[5])**2 and (p[0]-p[3])**2 + (p[1]-p[4])**2 < (p[2]+p[5])**2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s346559010
p00023
Wrong Answer
n=int(input()) for i in range(n): points = input().split() p = list(map(float,points)) if (p[3]-p[0])**2 + (p[4]-p[1])**2 <= (p[2]-p[5])**2: if p[5]>p[2]: print(-2) else: print(2) elif (p[0]-p[3])**2 + (p[1]-p[4])**2 > (p[2]-p[5])**2 and (p[0]-p[3])**2 + (p[1]-p[4])**2 <= (p[2]+p[5])**2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s156564162
p00023
Wrong Answer
# coding=utf-8 import math def square(number: float) -> float: return number * number if __name__ == '__main__': N = int(input()) for i in range(N): xa, ya, ra, xb, yb, rb = map(float, input().split()) distance = math.sqrt(square(xb - xa) + square(yb - ya)) if distance > (ra + rb): print(0) elif distance >= math.fabs(ra - rb): print(1) elif distance < math.fabs(ra - rb): if ra > rb: print(2) elif ra < rb: print(1) else: pass
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s848168883
p00023
Wrong Answer
n = int(input()) for _ in range(n): xa, ya, ra, xb, yb, rb = map(float, input().split()) dist = ((xa - xb)**2 + (ya - yb)**2)**.5 if ra + rb < dist: print('0') elif (rb < ra) and (dist < ra): print('2') elif (ra < rb) and (dist < rb): print('-2') else: print('1')
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s178325496
p00023
Wrong Answer
import math count = int(input()) for i in range(count): x1,y1,r1,x2,y2,r2 =map(float,input().split()) depth=math.sqrt((x1-x2)**2+(y1-y2)**2) if depth+r2<=r1: print(2) elif depth>r1+r2: print(0) else: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s988045568
p00023
Wrong Answer
import math count = int(input()) for i in range(count): x1,y1,r1,x2,y2,r2 =map(float,input().split()) depth=math.sqrt((x1-x2)**2+(y1-y2)**2) if depth+r2<=r1: print(2) elif depth+r1<=r2: print(-2) elif depth>r1+r2: print(0) else: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s644564977
p00023
Wrong Answer
# coding:utf-8 import math n = input() for i in range(n): slist = [] slist = map(float, raw_input().split()) kyouri = (slist[0] - slist[3]) * (slist[0] - slist[3]) + \ (slist[1] - slist[4]) * (slist[1] - slist[4]) r = math.sqrt(kyouri) sa = slist[2] - r if sa < 0: if abs(sa) < slist[5]: if slist[5] > r + slist[2]: print-2 else: print 1 else: print 0 else: if slist[5] < sa: print 2 elif 2 * r - sa < slist[5]: print -2 else: print 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s583621978
p00023
Wrong Answer
# coding:utf-8 import math n = input() for i in range(n): slist = [] slist = map(float, raw_input().split()) kyouri = (slist[0] - slist[3]) * (slist[0] - slist[3]) + \ (slist[1] - slist[4]) * (slist[1] - slist[4]) r = math.sqrt(kyouri) sa = slist[2] - r if sa < 0: if abs(sa) < slist[5]: if slist[5] > r + slist[2]: print-2 else: print 1 else: print 0 else: if slist[5] < sa: print 2 elif 2 * r - sa < slist[5]: print -2 else: print 1,
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s770384759
p00023
Wrong Answer
n=int(raw_input()) for i in range(n): x1,y1,r1,x2,y2,r2=map(float,raw_input().split()) d = ((x2-x1)**2+(y2-y1)**2)**0.5 if d+r2<=r1: print 2 elif d+r1<=r2: print -2 elif r1+r2>= d: print 1 elif r1+r2<d: print 0 else: print "error"
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s430389120
p00023
Wrong Answer
for _ in[0]*int(input()): x,y,r,s,t,u=map(float,input().split()) d=((x-s)**2+(y-t)**2)**.5 print([[[1,2][d<u-r],[1,2][d<r-u]][r>u],0][r+u<d])
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s005362745
p00023
Wrong Answer
import math for _ in range(int(input())): xa, ya, ra, xb, yb, rb = map(float, input().split()) d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2) if ra + rb < d: print(0) elif d + ra <= rb: print(-2) elif d + rb <= ra: print(2) else: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s291610559
p00023
Wrong Answer
import math N = int(input()) for _ in [0]*N: x1, y1, r1, x2, y2, r2 = map(float, input().split()) dist = math.sqrt((x1-x2)**2+(y1-y2)**2) if dist <= abs(r1-r2): print(2 if r1 > r2 else -2) elif dist <= r1+r2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s305775666
p00023
Wrong Answer
import math N = int(input()) for _ in [0]*N: x1, y1, r1, x2, y2, r2 = map(float, input().split()) dist = math.sqrt((x1-x2)**2+(y1-y2)**2) if dist+r2 <= r1: print(2) elif dist+r1 <= r2: print(-2) elif dist <= r1+r2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s920021407
p00023
Wrong Answer
import math N = int(input()) for _ in [0]*N: x1, y1, r1, x2, y2, r2 = map(float, input().split()) dist = math.hypot(x1-x2, y1-y2) if dist+r2 <= r1: print(2) elif dist+r1 <= r2: print(-2) elif dist <= r1+r2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s652788313
p00023
Wrong Answer
import math N = int(input()) for _ in [0]*N: x1, y1, r1, x2, y2, r2 = map(float, input().split()) dist = math.hypot(x2-x1, y2-y1) if dist+r2 <= r1: print(2) elif dist+r1 <= r2: print(-2) elif dist <= r1+r2: print(1) else: print(0)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s569018753
p00023
Wrong Answer
from decimal import Decimal def dist(x1, y1, x2, y2): return ((x1 - x2)**2 + (y1 - y2)**2)**Decimal('0.5') N = int(raw_input()) while (N): N -= 1 xa, ya, ra, xb, yb, rb = map(Decimal, raw_input().split()) d = dist(xa, ya, xb, yb) if d + rb <= ra: s = 2 elif d + ra <= rb: s = -2 elif d <= ra + rb: s = 1 else: s = 0 print s
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s266341286
p00023
Wrong Answer
from decimal import Decimal def dist(x1, y1, x2, y2): return ((x1 - x2)**2 + (y1 - y2)**2)**Decimal('0.5') N = int(raw_input()) while (N): N -= 1 xa, ya, ra, xb, yb, rb = map(Decimal, raw_input().split()) d = dist(xa, ya, xb, yb) if d + rb < ra: s = 2 elif d + ra < rb: s = -2 elif d < ra + rb: s = 1 else: s = 0 print
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s117735850
p00023
Wrong Answer
import math N = input() answers = [] for val in range(1,N+1): x = map(float,raw_input().split(' ')) d = (x[0]-x[3])**2 + (x[1]-x[4])**2 math.sqrt(d) math.fabs(d) s = x[2]+x[5] r = math.fabs(x[2]-x[5]) if r >= d: if x[2] > x[5]: answers.append(2) else: answers.append(-2) elif s < d: answers.append(0) else: answers.append(1) for val in answers: print val
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s959417391
p00023
Wrong Answer
import math N = input() answers = [] for val in range(1,N+1): x = map(float,raw_input().split(' ')) d = (x[0]-x[3])**2 + (x[1]-x[4])**2 math.sqrt(d) math.fabs(d) s = x[2]+x[5] r = math.fabs(x[2]-x[5]) if r >= d: if x[2] > x[5]: answers.append(2) else: answers.append(-2) elif s >= d: answers.append(1) else: answers.append(0) for val in answers: print val
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s606225186
p00023
Wrong Answer
import sys import math class Circle: def __init__(self, x, y, r): self.x = x self.y = y self.r = r def distance(self, other): dx = self.x - other.x dy = self.y - other.y return math.sqrt(dx ** 2 + dy ** 2) def intersection(self, other): d = self.distance(other) if self.r > d + other.r: return 2 elif other.r > d + self.r: return -2 elif d < self.r + other.r: return 1 else: return 0 #input_file = open(sys.argv[1], "r") sys.stdin.readline() for line in sys.stdin: (xa, ya, ra, xb, yb, rb) = tuple(map(float, line.split(' '))) ca = Circle(xa, ya, ra) cb = Circle(xb, yb, rb) print ca.intersection(cb)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s187558872
p00023
Wrong Answer
import math n = input() for i in range(n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split()) r = ((xa-xb)**2 + (ya-yb)**2)**.5 if ra+rb<r: print 0 elif abs(ra-rb)<r: print 1 elif ra-rb>r: print 2 else: print -2
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s685250753
p00023
Wrong Answer
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: if d+rb < ra: print 2 elif ra+rb <= d: print 1 else: print 0 if ra < rb: if d+ra < rb: print 2 elif ra+rb <= d: print 1 else: print 0
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s720819681
p00023
Wrong Answer
import math n = int(raw_input()) for i in range(n): xa,ya,ra,xb,yb,rb = map(float, raw_input().split()) d = math.sqrt((xa-xb)**2+(ya-yb)**2) if ra+rb < d: print 0 elif ra > rb: if d+rb < ra: print 2 else: print 1 elif ra < rb: if d+ra < rb: print -2 else: print 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s708362438
p00023
Wrong Answer
import math def length(xa, ya, xb, yb): return math.sqrt((xa - xb)**2 + (ya - yb)**2) n = int(raw_input()) for s in range(0, n): xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' ')) d = length(xa, ya, xb, yb) if ra > rb + d: print 2 elif rb > ra + d: print -2 elif d < ra + rb: print 0 else: print 1
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>
s535289405
p00023
Wrong Answer
# your code goes here import math n = int(input()) for i in range(n): xa, ya, ra, xb, yb, rb = [float(x) for x in input().split(" ")] distance = math.sqrt((xb-xa)**2 + (yb-ya)**2) if distance > ra+rb: print(0) elif distance <= abs(ra-rb): if ra > rb: print(2) elif ra < rb: print(-2) else: print(1) elif distance <= ra+rb: print(1)
2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0
2 0
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circles Intersection</H1> <p> You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. </p> <p> Write a program which prints: </p> <ul> <li>"2" if $B$ is in $A$,</li> <li>"-2" if $A$ is in $B$, </li> <li>"1" if circumference of $A$ and $B$ intersect, and</li> <li>"0" if $A$ and $B$ do not overlap.</li> </ul> <p> You may assume that $A$ and $B$ are not identical. </p> <H2>Input</H2> <p> The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:<br/> <br/> $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$<br/> </p> <H2>Output</H2> <p> For each dataset, print 2, -2, 1, or 0 in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 5.0 0.0 0.0 4.0 0.0 0.0 2.0 4.1 0.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 2 0 </pre>