submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s639198803
p00015
Runtime Error
import math n = int(input()) for i in range(n): x = int(input()) y = int(input()) if int(math.log10(x + y) + 1) > 80: print("overflow") else: print(x + y)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s528050985
p00015
Runtime Error
import math n = int(input()) for i in range(n): x = int(input()) y = int(input()) if int(math.log10(x + y) + 1) > 80: print("overflow") else: print(x + y)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s634840224
p00015
Runtime Error
""" # Too slow def add2(a, b): a, b = align_digit(a, b) zipped = zip(a[::-1], b[::-1]) carry = 0 result = [] for a, b in zipped: s = int(a) + int(b) + carry carry = int(s / 10) result.append(str(s % 10)) if result[-1] == '0': result[-1] = str(carry) print(''.join(result[::-1])) """ def align_digit(a, b): la, lb = len(a), len(b) if la < lb: a = a.zfill(lb) elif lb < la: b = b.zfill(la) return a, b def split_to_ints(s, n=10): length = len(s) return [int(s[i-n:i]) for i in range(length, 0, -n)] def add(a, b, n=10): a, b = align_digit(a, b) print(a, b) ints_a = split_to_ints(a, n) ints_b = split_to_ints(b, n) carry = 0 result = [] zipped = list(zip(ints_a, ints_b))[::-1] print(zipped) for i, (int_a, int_b) in enumerate(zipped): s = int_a + int_b + carry carry = int(s / (10 ** n)) if i != len(zipped) - 1: result.append(str(s % (10 ** (n - 1))).zfill(n)) else: result.append(str(s)) print(result) ret = str(int(''.join(reversed(result)))) if len(ret) > 80: return 'overflow' return ret if __name__ == '__main__': n_input = int(input()) for i in range(n_input): a, b = input(), input() print(add(a, b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s376336548
p00015
Runtime Error
while True: count = int(input()) for a in range(count): q,w =int(input()),int(input()) t=q+w if t >10**80: print "overflow" else: print t
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s591211022
p00015
Runtime Error
line_num = int(raw_input()) for n in range(line_num): a = raw_input() b = raw_input() ov = 0 if len(a) > 80 or len(b) > 80: print 'overflow' ov = 1 filled_a, filled_b = a.zfill(80), b.zfill(80) rlist_a = map(int,list(filled_a)[::-1]) rlist_b = map(int,list(filled_b)[::-1]) rlist_sum = [] for n in range(80): rlist_sum.append(rlist_a[n]+rlist_b[n]) for n in range(79): if rlist_sum[n] > 9: rlist_sum[n] -= 10 rlist_sum[n+1] += 1 if rlist_sum[79] > 9: if ov < 1: print 'overflow' else list_sum = [] f = 0 for n in rlist_sum[::-1]: if f > 0: list_sum.append(n) else: if n > 0: f = 1 list_sum.append(n) print ''.join(map(str,list_sum))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s811080794
p00015
Runtime Error
import sys ds = int(raw_input()) list =[int(x) for x in sys.stdin] print list for i in xrange(ds): print str(list[i*2]+list[i*2+1])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s092400864
p00015
Runtime Error
import sys ds = int(raw_input()) list =[long(x) for x in sys.stdin] print list for i in xrange(ds): print str(list[i*2]+list[i*2+1])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s152401463
p00015
Runtime Error
import sys ds = int(raw_input()) list =[int(x) for x in sys.stdin.readlines()] print list for i in xrange(ds): print str(list[i*2]+list[i*2+1])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s583631837
p00015
Runtime Error
import sys ds = int(raw_input()) list =[long(x.strip()) for x in sys.stdin.readlines()] print list for i in xrange(ds): sum = str(list[i*2]+list[i*2+1]) if len(sum) > 80: print "overflow" else: print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s235071268
p00015
Runtime Error
n=input() for i in range(n): a=input() b=input() if str(a+b)>80: print overflow else: print a+b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s196033184
p00015
Runtime Error
import sys def to_list(n): l = list(n) ls = len(l) l = ['0'] * (80 - ls) + l l.reverse() return l def add(a, b, c): x = a + b + c if x >= 10: y = x / 10 x = x % 10 else: y = 0 return (x, y) def str_add(a, b): s = a[0] k = a[1] i = int(b[0]) j = int(b[1]) (x, y) = add(i, j, k) return (s + str(x), y) def str_format(s): l = list(s) l.reverse() s = ''.join(l) return s.lstrip('0') def solv(a, b): la = to_list(a) lb = to_list(b) z = map((lambda x, y: (x, y)), la, lb) r = reduce((lambda a, b: str_add(a, b)), z, ('', 0)) if r[1] > 0: return "overflow" else: result = str_format(r[0]) return result def make_pair(lis): ps = [] while lis: a = lis.pop(0).rstrip("\r\n") b = lis.pop(0).rstrip("\r\n") ps.append((a, b)) return ps #input_file = open(sys.argv[1], "r") #lines = input_file.readlines() lines = sys.stdin.readlines() lines.pop(0) pairs = make_pair(lines) for p in pairs: result = solv(p[0], p[1]) print result
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s940057852
p00015
Runtime Error
# # AIZU ONLINE JUDGE: National Budget # cf. http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0015&lang=jp # import sys def to_list(n): l = list(n) ls = len(l) l = ['0'] * (80 - ls) + l l.reverse() return l def add(a, b, c): x = a + b + c if x >= 10: y = x / 10 x = x % 10 else: y = 0 return (x, y) def str_add(a, b): s = a[0] k = a[1] i = int(b[0]) j = int(b[1]) (x, y) = add(i, j, k) return (s + str(x), y) def str_format(s): l = list(s) l.reverse() s = ''.join(l) return s.lstrip('0') def solv(a, b): la = to_list(a) lb = to_list(b) z = map((lambda x, y: (x, y)), la, lb) r = reduce((lambda a, b: str_add(a, b)), z, ('', 0)) if r[1] > 0: return "overflow" else: result = str_format(r[0]) return result def make_pair(lis): ps = [] while lis: a = lis.pop(0).rstrip("\r\n") b = lis.pop(0).rstrip("\r\n") ps.append((a, b)) return ps lines = sys.stdin.readlines() lines.pop(0) pairs = make_pair(lines) for p in pairs: result = solv(p[0], p[1]) print result
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s643078338
p00015
Runtime Error
while True: a=raw_input() b=raw_input() if int((a + b) / 10**80): print "overflow" else: print a + b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s998603672
p00015
Runtime Error
a=raw_input() b=raw_input() total=a+b if int(total/10**80): print "overflow" else: print total
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s100520365
p00015
Runtime Error
a=input() b=input() total=a+b if int(total/10**80) print "overflow" else: print total
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s395937900
p00015
Runtime Error
n = int(raw_input()) for i in range(0,n); a = int(raw_input()) b = int(raw_input()) ans = str(a+b) if len(ans) > 80; print 'overflow' else: print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s755554060
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "999999999999999999999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print c else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s368616675
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "999999999999999999999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print str(c) else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s059903376
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: [a, b] = [0, 0] continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print str(c) else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s286956106
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys [a, b, c] = [0, 0, 0] lineNumber = 0 #for line in [ "2", "1000", "800", "99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print str(c) else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s588155164
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print str(c) else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s894792535
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data #List = map(int, line.strip().split()) List = [ int(line.strip()) ] # set data if lineNumber % 2 == 0: a = List[0] else : b = List[0] # sum if lineNumber % 2 == 1: c = a + b if c < 10**79: print str(c) else : print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s314337663
p00015
Runtime Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: if not out: out = True else : print maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow", continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow", else : print int(c),
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s096549901
p00015
Runtime Error
n=input() for i in range(0,n): a=input() b=input() s=str(a+b) if(len(s)<=80): print a+b else print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s094596930
p00015
Runtime Error
n=input() for i in range(0,n): a=input() b=input() s=str(a+b) if(len(s)<=80): print str(a+b) else print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s375753885
p00015
WA: Presentation Error
if __name__ == '__main__': n = (int)(input()) for _ in range(n): sNumber = (int)(input()) tNumber = (int)(input()) uNumber = sNumber+tNumber print("over flow" if uNumber >= 10**80 else uNumber)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s280032290
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "9999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow" continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow" else : print c
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s694609396
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "9999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow" continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow" else : print c print
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s574075051
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 #for line in [ "2", "1000", "800", "9999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow\n" continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow\n" else : print c print
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s228754252
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: if not out: out = True else : print maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow", continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow", else : print c, print
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s291299019
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: if not out: out = True else : print maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow", continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow", else : print c,
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s711406801
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: # if not out: out = True # else : print maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow" continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow" else : print c
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s315279019
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: if not out: out = True else : print "\n", maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow", continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow", else : print c,
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s130859503
p00015
WA: Presentation Error
# -*- coding: utf-8 -*- import sys lineNumber = 0 out = False #for line in [ "2", "1000", "800", "9999999999", "1" ]: for line in sys.stdin.readlines(): lineNumber += 1 # line exception if lineNumber == 1: continue # get data #List = map(int, line.strip().split()) # set data if lineNumber % 2 == 0: a = line.strip() else : b = line.strip() # sum if lineNumber % 2 == 1: # if not out: out = True # else : print "\n", maxlen = max(len(a), len(b)) if maxlen > 80: print "overflow" continue upper = 0 c = "" for i in xrange(1, maxlen+1): try: buf = int(a[-i]) + int(b[-i]) + upper upper = buf / 10 buf %= 10 except: try: buf = int(a[-i]) + upper upper = buf / 10 buf %= 10 except: buf = int(b[-i]) + upper upper = buf / 10 buf %= 10 c = str(buf) + c if upper != 0: c = str(upper) + c if len(c) > 80: print "overflow" else : print c
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s614038581
p00016
Wrong Answer
import math now_r=0 now_x=0 now_y=0 while True: n,r=map(int,raw_input().split(",")) if n==0 and r==0: break now_x+=n*math.sin((now_r/180.0)*math.pi) now_y+=n*math.cos((now_r/180.0)*math.pi) now_r+=r print "{0:.0f} {1:.0f}".format(now_x,now_y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s993129535
p00016
Wrong Answer
import math now_r=0 now_x=0 now_y=0 while True: n,r=map(int,raw_input().split(",")) if n==0 and r==0: break now_x+=n*math.sin((now_r/180.0)*math.pi) now_y+=n*math.cos((now_r/180.0)*math.pi) now_r+=r print "{0:.0f}\n{1:.0f}".format(now_x,now_y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s032932086
p00016
Wrong Answer
import math now_r=0 now_x=0 now_y=0 while True: n,r=map(int,raw_input().split(",")) if n==0 and r==0: break now_x+=n*math.sin((now_r/180.0)*math.pi) now_y+=n*math.cos((now_r/180.0)*math.pi) now_r+=r print math.floor(now_x) print math.floor(now_y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s765757012
p00016
Wrong Answer
import math x=0 y=0 angle=0 while True: r,c=map(int, input().split(",")) if r == c == 0: break x += r*math.cos(-angle) y += r*math.sin(-angle) angle += c print(x) print(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s959456070
p00016
Wrong Answer
from decimal import Decimal import math def walk(x, y, distance, angle, next_angle): radian = math.radians(angle) _x = Decimal(distance * math.cos(radian) + x) x = round(_x, 6) _y = Decimal(distance * math.sin(radian) + y) y = round(_y, 6) angle = angle - next_angle return x, y, angle x = 0 y = 0 angle = 90 while True: input_line = raw_input() distance = int(input_line.split(',')[0]) next_angle = int(input_line.split(',')[1]) if distance == 0 and next_angle == 0: break x, y, angle = walk(x, y, distance, angle, next_angle) print int(x), int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s223376903
p00016
Wrong Answer
import math as m x,y,d=0,0,90 while True: r,t=map(int,input().split(",")) if (r,t)==(0,0): break x+=r*m.cos(m.radians(d)) y+=r*m.sin(m.radians(d)) d-=t print(int(m.sqrt(x**2+y**2))) print(d)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s925990936
p00016
Wrong Answer
import math x, y, r = 0, 0, 90 while True: d, t = map(int, input().split(",")) if d == t == 0: break x += r * math.cos(math.radians(r)) y += r * math.sin(math.radians(r)) r -= t print(int(x)) print(int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s247715521
p00016
Wrong Answer
import math x, y, r = 0, 0, 90 while True: d, t = map(float, input().split(",")) if d == t == 0: break x += r * math.cos(math.radians(r)) y += r * math.sin(math.radians(r)) r -= t print(int(x)) print(int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s052203182
p00016
Wrong Answer
import sys import itertools import math curdeg = 90 xstep = 0 ystep = 0 for line in sys.stdin.readlines(): step, deg = map(int, line.split(",")) xstep += -step * math.cos(math.pi * curdeg / 180) ystep += step * math.sin(math.pi * curdeg / 180) curdeg += deg print("{:.0f}".format(xstep)) print("{:.0f}".format(ystep))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s090336206
p00016
Wrong Answer
import sys import itertools import math curdeg = 0 xstep = 0 ystep = 0 for line in sys.stdin.readlines(): step, deg = map(int, line.split(",")) xstep += step * math.cos(math.pi * curdeg / 180) ystep += step * math.sin(math.pi * curdeg / 180) curdeg += deg print("{:.0f}".format(xstep)) print("{:.0f}".format(ystep))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s731937296
p00016
Wrong Answer
import sys import itertools import math curdeg = 0 xstep = 0 ystep = 0 for line in sys.stdin.readlines(): step, deg = map(int, line.split(",")) xstep += step * math.cos(math.pi * curdeg / 180) ystep += step * math.sin(math.pi * curdeg / 180) curdeg += deg print("{:.0f}".format(ystep)) print("{:.0f}".format(xstep))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s389667935
p00016
Wrong Answer
from math import * x , y = 0, 0 rad = radians(90) while 1: d, t = map(int, raw_input().split(',')) if d == 0: break x = x + cos(rad) * d y = y + sin(rad) * d rad -= radians(t) print x print y
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s271229620
p00016
Wrong Answer
from math import sin,cos,pi x = 0 y = 0 ca = pi/2 while True: d, a = list(map(int, input().split(","))) if d or a: x += d*cos(ca) y += d*sin(ca) ca -= a*pi/180 else: break print("{0:.0f}".format(x)) print("{0:.0f}".format(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s867584148
p00016
Wrong Answer
from math import sin,cos,pi x = 0 y = 0 ca = pi/2 while True: d, a = list(map(int, input().split(","))) if d or a: x += d*cos(ca) y += d*sin(ca) ca -= a*pi/180 else: break print("{0:.0f}".format(x)) print("{0:.0f}".format(y),end="")
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s268168756
p00016
Wrong Answer
from math import sin,cos,pi x = 0 y = 0 ca = 90 while True: d, a = list(map(int, input().split(","))) if d or a: x += d*cos(ca*pi/180) y += d*sin(ca*pi/180) ca -= a else: break print("{0:.0f}".format(x)) print("{0:.0f}".format(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s219422403
p00016
Wrong Answer
import sys import math as mas x,y,d=0,0,90 for t in sys.stdin: a,b=map(int,t.split(',')) if a==b==0:break x+=a*mas.cos(mas.radians(d)) y+=a*mas.sin(mas.radians(d)) d-=b print(x) print(y) #for i in sys.stdin: # a,b=map(int,i.split()) # print(gcd(a,b),lcm(a,b))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s844633422
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(A[i] * pi / 180) y = y + D[i] * sin(A[i] * pi / 180) print(x,y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s179619885
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(A[i] * pi / 180) y = y + D[i] * sin(A[i] * pi / 180) print(x) print(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s369876465
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(A[i] * pi / 180) y = y + D[i] * sin(A[i] * pi / 180) print(floor(x)) print(floor(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s836778184
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(A[i] * pi / 180) y = y - D[i] * sin(A[i] * pi / 180) print(floor(x)) print(floor(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s388926907
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = floor(x + D[i] * cos(A[i] * pi / 180)) y = floor(y - D[i] * sin(A[i] * pi / 180)) print(x) print(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s859207118
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] sum_a = -90 while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x += D[i] * cos(-sum_a * pi / 180) y += D[i] * sin(-sum_a * pi / 180) sum_a += A[i] print(floor(x)) print(floor(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s559748331
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] sum_a = -90 while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(sum_a * pi / 180) y = y - D[i] * sin(sum_a * pi / 180) sum_a += A[i] print(round(x)) print(round(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s583959421
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] sum_a = -90 while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(sum_a * pi / 180) y = y - D[i] * sin(sum_a * pi / 180) if abs(x-round(x))<10**(-5): x=round(x) if abs(y - round(y)) < 10 ** (-5): y=round(y) sum_a += A[i] print(floor(x)) print(floor(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s108837762
p00016
Wrong Answer
from math import * x = 0 y = 0 D = [] A = [] sum_a = -90 while True: d, a = map(int, input().split(",")) if a == 0 and d == 0: break else: D.append(d) A.append(a) for i in range(len(A)): x = x + D[i] * cos(sum_a * pi / 180) y = y - D[i] * sin(sum_a * pi / 180) if abs(x-round(x))<10**(-7): x=round(x) if abs(y - round(y)) < 10 ** (-7): y=round(y) sum_a += A[i] print(floor(x)) print(floor(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s032161411
p00016
Wrong Answer
import sys import math def TreasureHunt(): x,y=(0.0,0.0) alpha=90 for line in sys.stdin: a,b=list(map(int,line.split(','))) if a==0 and b==0: break x+=a*math.cos(alpha/180.0*math.pi) y+=a*math.sin(alpha/180.0*math.pi) alpha=(alpha-b+360)%360 print(int(x),int(y)) TreasureHunt()
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s147121409
p00016
Wrong Answer
# coding=utf-8 import math x = 0 y = 0 direction = math.pi/2 while True: d, a = map(int, input().split(',')) if d == 0 and a == 0: break x += d * math.cos(direction) y += d * math.sin(direction) direction -= a*math.pi/180 print('{0:.0f}'.format(x)) print('{0:.0f}'.format(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s180154434
p00016
Wrong Answer
# -*- coding:utf-8 -*- import math a, b = map(int, raw_input().split(",")) c = 0 x = 0 y = 0 while a != 0 and b != 0: x += a * math.sin(float(2 * math.pi * c / 360)) y += a * math.cos(float(2 * math.pi * c / 360)) c += b a, b = map(int, raw_input().split(",")) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s591768638
p00016
Wrong Answer
# -*- coding:utf-8 -*- import math a, b = map(int, raw_input().split(",")) c = 0 x = 0 y = 0 while a != 0 and b != 0: x += a * math.sin(float(2 * math.pi * c / 360)) y += a * math.cos(float(2 * math.pi * c / 360)) c -= b a, b = map(int, raw_input().split(",")) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s808683231
p00016
Wrong Answer
# -*- coding:utf-8 -*- import math a, b = map(int, raw_input().split(",")) c = 0 x = 0 y = 0 while a != 0 and b != 0: x += a * math.sin(2 * math.pi * c / 360) y += a * math.cos(2 * math.pi * c / 360) c += b a, b = map(int, raw_input().split(",")) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s315570411
p00016
Wrong Answer
treasure_x, treasure_y = 0, 0 while True: x, y = map(int, input().split(',')) if x == 0 and y == 0: break treasure_x += x treasure_y += y print(treasure_x) print(treasure_y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s828968740
p00016
Wrong Answer
from math import cos, sin, pi treasure_x, treasure_y = 0, 0 angle = 90 while True: d, a = map(int, input().split(',')) if d == 0 and a == 0: break radian_a = a * 2 * pi / 180 treasure_x += d * cos(radian_a) treasure_y += d * sin(radian_a) print(int(treasure_x)) print(int(treasure_y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s401587781
p00016
Wrong Answer
from math import cos, sin, pi treasure_x, treasure_y = 0, 0 angle = pi / 2 while True: d, a = map(int, input().split(',')) if d == 0 and a == 0: break treasure_x += d * cos(angle) treasure_y += d * sin(angle) angle += a * 2 * pi / 180 print(int(treasure_x)) print(int(treasure_y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s918062265
p00016
Wrong Answer
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s912044622
p00016
Wrong Answer
import cmath,math,sys z=0;p=90 for e in sys.stdin: r,d=map(int,e.split(',')) z+=cmath.rect(r,math.radians(p)) p-=d print(int(z.real),int(z.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s569879071
p00016
Wrong Answer
import math x = y = n= 0 while True: d,a = map(int,input().split(',')) if d == a == 0: break x += d*math.sin(math.radians(n)) y += d*math.cos(math.radians(n)) n+=a print(map(int,(x,y)),sep='\n')
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s175711005
p00016
Wrong Answer
import math x = y = n= 0 while True: d,a = map(int,input().split(',')) if d == a == 0: break x += d*math.sin(math.radians(n)) y += d*math.cos(math.radians(n)) n+=a print(map(int,(x,y)),sep=',')
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s922744162
p00016
Wrong Answer
import math x = y = n= 0 while True: d,a = map(int,input().split(',')) if d == a == 0: break x += d*math.sin(math.radians(n)) y += d*math.cos(math.radians(n)) n+=a print(*map(int,(x,y)),sep=',')
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s879329079
p00016
Wrong Answer
import math x = y = 0 h = math.radians(90) while True: d, t = map(int, input().split(",")) if d == t == 0: break x += d * math.cos(h) y += d * math.sin(h) h -= math.radians(t) print("{} {}".format(int(x), int(y)))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s743600493
p00016
Wrong Answer
import math x = y = 0 h = math.radians(90) while True: d, t = map(int, input().split(",")) if d == t == 0: break x += d * math.cos(h) y += d * math.sin(h) h -= math.radians(t) print("{} {}".format(int(math.modf(x)[1]), int(math.modf(y)[1])))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s265750641
p00016
Wrong Answer
import math x = y = 0 h = math.radians(90) while True: d, t = map(int, input().split(",")) if d == 0 and t == 0: break x += d * math.cos(h) y += d * math.sin(h) h -= math.radians(t) print("{} {}".format(int(math.modf(x)[1]), int(math.modf(y)[1])))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s062111959
p00016
Wrong Answer
import math pi = math.acos(-1) d0,t0 = map(int,raw_input().split(',')) pos=[0,d0,90-t0]#[x,y,digree] while True: d,t= map(int,raw_input().split(',')) if d!=0 and t!=0: pos[0]+=d*math.cos(float(pos[2])*pi/180) pos[1]+=d*math.sin(float(pos[2])*pi/180) pos[2]-=t else: print int(pos[0]),'\n',int(pos[1]) break
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s372819708
p00016
Wrong Answer
import math pi = math.pi pos=[0,0,90]#[x,y,digree] while True: d,t= map(int,raw_input().split(',')) if d!=0 and t!=0: pos[0]+=d*math.cos(math.radians(pos[2])) pos[1]+=d*math.sin(math.radians(pos[2])) pos[2]-=t else: print int(pos[0]),'\n',int(pos[1]) break
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s409047125
p00016
Wrong Answer
import turtle kame = turtle.Turtle() kame.speed(0) while True: x = map(int,raw_input().split(',')) if x[0] == 0 and x[1] == 0: break else: kame.right(x[0]) kame.fd(x[1]) continue print kame.xcor() print kame.ycor()
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s350464861
p00016
Wrong Answer
import turtle kame = turtle.Turtle() kame.speed(0) kame.left(90) while True: x = map(int,raw_input().split(',')) if x[0] == 0 and x[1] == 0: break else: kame.right(x[0]) kame.fd(x[1]) continue print kame.xcor() print kame.ycor()
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s831815675
p00016
Wrong Answer
import math x = 0 y = 0 while True: a = map(int,raw_input().split(',')) if a[0] == 0: if a[1] == 0: break x += a[0] * math.sin(a[1]) y += a[0] * math.cos(a[1]) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s143114273
p00016
Wrong Answer
import math x = 0 y = 0 while True: a = map(float,raw_input().split(',')) if a[0] == 0: if a[1] == 0: break x += a[0] * math.cos(a[1]/180 * math.pi) y += a[0] * math.sin(a[1]/180 * math.pi) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s374909599
p00016
Wrong Answer
import math x = 0 y = 0 while True: leng,ang = map(float,raw_input().split(',')) if leng == 0: if ang == 0: break x += leng * math.sin(ang/180 * math.pi) y += leng * math.cos(ang/180 * math.pi) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s575593614
p00016
Wrong Answer
import math cl = [0, 0] cd = 0 while True: o = input() if o == (0, 0): break cl[0] += o[0] * math.sin(cd) cl[1] += o[0] * math.cos(cd) cd += math.radians(o[1]) for x in cl: print(int(math.floor(x)))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s221264901
p00016
Wrong Answer
anslist=[0,0] while True: inputlist=map(int,raw_input().split(",")) if(inputlist[0]==0 and inputlist[1]==0): break anslist[0]+=inputlist[0] anslist[1]+=inputlist[1] print anslist[0] print anslist[1]
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s148003964
p00016
Wrong Answer
# -*- coding: utf-8 -*- import sys from math import * lineNumber = 0 coord = [0, 0] theta = 0.5 * pi #for line in [ for line in sys.stdin.readlines(): lineNumber += 1 # get data List = map(float, line.strip().split(",")) # set data forward = List[0] d_theta = List[1] / 180.0 * pi # solve coord[0] += forward * cos(theta) coord[1] += forward * sin(theta) theta += d_theta print int(ceil(coord[0])) print int(ceil(coord[1]))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s513507995
p00016
Wrong Answer
import math x = 0.0 y = 0.0 theta = 0 while True: m, r = map(int, raw_input().split(",")) if m == 0 and r == 0: break theta += r rad = theta/180*math.pi x += m*math.cos(rad) y += m*math.sin(rad) print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s682140652
p00016
Wrong Answer
import math x = 0.0 y = 0.0 theta = 90 while True: m, r = map(int, raw_input().split(",")) if m == 0 and r == 0: break rad = theta/180*math.pi x += m*math.cos(rad) y += m*math.sin(rad) theta += -r print int(x) print int(y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s231430661
p00016
Wrong Answer
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(int, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg += d print(-int(z.real), int(z.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s425984092
p00016
Wrong Answer
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(int, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg += d print(int(z.real), int(z.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s551625656
p00016
Wrong Answer
from math import radians, sin, cos x = y = 0 deg = 90 while True: r, d = map(int, input().split(',')) if r == d == 0: break x += r * cos(radians(deg)) y += r * sin(radians(deg)) deg -= d print(int(x), int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s914378059
p00016
Wrong Answer
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(int, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg -= d print(int(z.real), int(z.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s332406553
p00016
Wrong Answer
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(float, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg -= d print(int(z.real), int(z.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s487301613
p00016
Accepted
import math x, y = 0, 0 angle = math.pi / 2 while True: d, a = map(int, input().split(",")) if (d, a) == (0, 0): break x += math.cos(angle) * d y += math.sin(angle) * d angle -= a * math.pi / 180 print(int(x), int(y), sep="\n")
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s295482187
p00016
Accepted
import math import cmath coordinates = 0 ang = 90 while True: line = list(map(float, input().split(","))) if line[0] == 0 and line[1] == 0: break coordinates += cmath.rect(line[0], math.radians(ang)) ang -= line[1] print(int(coordinates.real)) print(int(coordinates.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s061256234
p00016
Accepted
import math x, y = 0, 0 angle = 90 while True: line = map(int, raw_input().split(',')) if line[0] == 0 and line[1] == 0: break radian = math.radians(angle) x += math.cos(radian) * line[0] y += math.sin(radian) * line[0] angle -= line[1] print(int(x)) print(int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s118798062
p00016
Accepted
import math x = 0 y = 0 degree = 0 while(True): a = map(int, raw_input().split(",")) if(a[0] == 0 and a[1] == 0): break x += a[0] * math.sin(math.radians(degree)) y += a[0] * math.cos(math.radians(degree)) degree += a[1] print(int(x)) print(int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s651233269
p00016
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import math def move(point,n,arg): return [ point[0]+n*arg[0], point[1]+n*arg[1] ] theta = 90 p = [0.0,0.0] for s in sys.stdin: d = map(int , s.split(",")) arg = [ math.cos(theta*math.pi/180), math.sin(theta*math.pi/180) ] p = move(p,d[0],arg) theta -= d[1] if d == [0,0]: for e in p: print int(e)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s336184787
p00016
Accepted
#!/usr/bin/python # AOJ # 0016 import math degree = 90 x = 0 y = 0 while True: a, b = map(int, input().split(',')) if a is 0 and b is 0: break x += a * math.cos(math.radians(degree)) y += a * math.sin(math.radians(degree)) degree -= b if degree > 360: degree -= 360 elif degree < 0: degree += 360 print(int(x)) print(int(y))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s755847749
p00016
Accepted
import sys f = sys.stdin import math, cmath direction = 1j location = 0 + 0j while True: step, degrees = map(int, f.readline().split(',')) location += direction * step direction *= cmath.rect(1, math.radians(-degrees)) if step == 0: break print(int(location.real)) print(int(location.imag))
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>
s490955262
p00016
Accepted
import math now_r=0 now_x=0 now_y=0 while True: n,r=map(int,raw_input().split(",")) if n==0 and r==0: break now_x+=n*math.sin((now_r/180.0)*math.pi) now_y+=n*math.cos((now_r/180.0)*math.pi) now_r+=r print int(now_x) print int(now_y)
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
<H1>Treasure Hunt</H1> <p> When a boy was cleaning up after his grand father passing, he found an old paper: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure_en"><br> </center> <br/> <!-- <center> <table> <tr> <td align="top"> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_treasure"> </td> <td align="top"> Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.<br> <pre> 30, 10 50, -40 20, 15 . . </pre> </td> </tr> </table> </center> --> <p> In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". </p> <p> His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper. </p> <p> For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers <var>d</var> (the first integer) and <var>t</var> (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (<var>x</var>, <var>y</var>) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town. </p> <p> You can assume that <var>d</var> &le; 100 and -180 &le; <var>t</var> &le; 180. </p> <H2>Input</H2> <p> A sequence of pairs of integers <var>d</var> and <var>t</var> which end with "<span>0,0</span>". </p> <H2>Output</H2> <p> Print the integer portion of <var>x</var> and <var>y</var> in a line respectively. </p> <H2>Sample Input</H2> <pre> 56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0 </pre> <H2>Output for the Sample Input</H2> <pre> 171 -302 </pre>