s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s450787078
p00016
u825618558
1451562674
Python
Python3
py
Accepted
40
8080
570
import sys import math def sign(x): if x>=0: return 1.0 else: return -1.0 pi = math.pi deg = 0.0 pos_x = 0.0 pos_y = 0.0 lines = sys.stdin.readlines() for line in lines: line = line.split(",") inp = [] for i in line: inp.append(int(i)) if inp[0]>0: dist = inp[0] pos_x += dist*math.sin(deg/180*pi) pos_y += dist*math.cos(deg/180*pi) deg += inp[1] else: print ("%d" % (sign(pos_x)*math.floor(math.fabs(pos_x)))) print ("%d" % (sign(pos_y)*math.floor(math.fabs(pos_y))))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,302
s395778587
p00016
u749493116
1452505069
Python
Python
py
Accepted
10
6716
379
#!/usr/bin/env python # -*- coding: utf-8 -*- import math def step(n, x, y, theta): x += n*math.sin(theta) y += n*math.cos(theta) return x, y n, m = 100, 100 x, y, theta = 0.0, 0.0, 0.0 while n != 0 and m != 0: n, m = map(int, raw_input().split(",")) m = (m * math.pi)/180 x, y = step(n, x, y, theta) theta = (m + theta) print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,303
s052269366
p00016
u512342660
1455335311
Python
Python
py
Accepted
10
6720
388
from math import * l2,angle2 = map(int,raw_input().split(",")) x_now = 0 y_now = l2 angle_now = 0 while True: l1 = l2 angle1 = angle2 if l1==0 and angle1==0: break l2,angle2 = map(int,raw_input().split(",")) angle_now += angle1 rad = radians(angle_now) x = l2*sin(rad) y = l2*cos(rad) x_now += x y_now += y print int(x_now) print int(y_now)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,304
s518223952
p00016
u650459696
1458459954
Python
Python3
py
Accepted
20
7852
242
from math import sin, cos from math import radians as rad x, y, t = 0, 0, 0 while(1): a, b = map(int,input().split(',')) if (a == b == 0): break; x += a * sin(rad(t)) y += a * cos(rad(t)) t += b print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,305
s920142370
p00016
u148101999
1459387924
Python
Python
py
Accepted
10
6720
280
import math x, y ,angle = 0, 0, 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))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,306
s493650460
p00016
u130979865
1459927164
Python
Python
py
Accepted
10
6864
267
# -*- coding: utf-8 -*- import math x = y = 0 tsum = 90 while True: d, t = map(int, raw_input().split(',')) if d == t == 0: break x += math.cos(math.radians(tsum))*d y += math.sin(math.radians(tsum))*d tsum -= t print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,307
s205673511
p00016
u966364923
1459949675
Python
Python3
py
Accepted
30
7920
243
import math x = 0 y = 0 r = 90 while True: d,t=map(int, input().split(',')) if d==0 and t==0: print(int(x),int(y),sep='\n') exit() x += math.cos(math.radians(r)) * d y += math.sin(math.radians(r)) * d r -= t
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,308
s652006222
p00016
u572790226
1460296661
Python
Python3
py
Accepted
30
7724
242
import math x = 0 y = 0 tt = 0 while True: d, t = map(float, input().split(',')) y += d * math.cos(tt / 180 * math.pi) x += d * math.sin(tt / 180 * math.pi) tt += t if d == t ==0: break print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,309
s094447439
p00016
u529386725
1461623332
Python
Python3
py
Accepted
30
7796
239
import math, cmath D = 90 p = complex(0, 0) while True: r, d = map(float, input().split(',')) if r == d == 0: print(int(p.real)) print(int(p.imag)) exit() p += cmath.rect(r, math.radians(D)) D -= d
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,310
s326246766
p00016
u957021485
1465618077
Python
Python3
py
Accepted
30
7860
310
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(int(ystep)) print(int(xstep))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,311
s201470815
p00016
u766477342
1466723485
Python
Python3
py
Accepted
20
7932
270
import math res_x, res_y = 0, 0 r = 90 while 1: x, y = list(map(int, input().split(','))) if x == 0 and y == 0: break r2 = math.radians(r) res_x += x * math.cos(r2) res_y += x * math.sin(r2) r = r - y print(int(res_x)) print(int(res_y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,312
s953170136
p00016
u896025703
1469539608
Python
Python3
py
Accepted
30
7980
295
import math def calc(x, y, r, d, nd): x = x + r * math.cos(math.radians(d)) y = y + r * math.sin(math.radians(d)) d -= nd return x, y, d x = y = 0 d = 90 while True: r, nd = map(int, input().split(",")) if r == nd == 0: break x, y, d = calc(x, y, r, d, nd) print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,313
s801091889
p00016
u582608581
1470885224
Python
Python3
py
Accepted
20
7712
243
import math x, y = 0.0, 0.0 theta = 0.0 while True: d, t = [eval(num) for num in input().split(',')] if d == 0 and t == 0: break x += d * math.sin(theta) y += d * math.cos(theta) theta += t * math.pi / 180.0 print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,314
s446054391
p00016
u146816547
1471534856
Python
Python
py
Accepted
0
6624
250
import math x, y, angle = 0, 0, 90 while True: d, a = map(int, raw_input().split(",")) if d == 0 and a == 0: break x += math.cos(math.radians(angle)) * d y += math.sin(math.radians(angle)) * d angle -= a print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,315
s469140580
p00016
u589886885
1471960808
Python
Python3
py
Accepted
20
7976
268
import math import sys x, y, r = 0, 0, 90 for i in sys.stdin.readlines(): d, a = [int(z) for z in i.split(',')] if d == a == 0: break x += d * math.cos(math.radians(r)) y += d * math.sin(math.radians(r)) r -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,316
s108311642
p00016
u358919705
1471976442
Python
Python3
py
Accepted
20
7976
247
import math x = y = 0 angle = 90 while True: d, a = map(int, input().split(',')) if d == a == 0: break x += d * math.cos(math.radians(angle)) y += d * math.sin(math.radians(angle)) angle -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,317
s907438385
p00016
u379499530
1473039225
Python
Python
py
Accepted
10
6812
222
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 int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,318
s840264804
p00016
u922871577
1479285104
Python
Python
py
Accepted
10
6644
289
from math import cos, sin, radians pos = [0, 0] b1 = 0 angle = 0 while True: a, b = map(int, raw_input().split(',')) if a == 0 and b == 0: break rad = radians(angle) pos[0] += -sin(rad)*a pos[1] += cos(rad)*a angle += b print -int(pos[0]) print int(pos[1])
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,319
s604056661
p00016
u301729341
1480932626
Python
Python3
py
Accepted
30
7840
333
import math Tre = [] num = 0 while True: li = list(map(int,input().split(","))) if li == [0,0]: break Tre.append(li) num += 1 x,y = 0,0 deg = 90 for i in range(num): x,y = x + Tre[i][0]*math.cos(math.pi*deg/180),y + Tre[i][0]*math.sin(math.pi*deg/180) deg = deg - Tre[i][1] print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,320
s220697103
p00016
u123687446
1481290440
Python
Python3
py
Accepted
30
7848
249
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(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,321
s738027041
p00016
u811733736
1481599506
Python
Python3
py
Accepted
30
7884
593
from math import radians, cos, sin if __name__ == '__main__': # ??????????????\??? directions = [] while True: distance, rotation = [int(x) for x in input().strip().split(',')] if distance == 0 and rotation == 0: break else: directions.append((distance, rotation)) # ??????????????? my_x = 0 my_y = 0 my_d = 90 for d in directions: my_x += d[0] * cos(radians(my_d)) my_y += d[0] * sin(radians(my_d)) my_d -= d[1] # ??????????????? print('{0}\n{1}'.format(int(my_x), int(my_y)))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,322
s595897349
p00016
u919202930
1481605597
Python
Python3
py
Accepted
20
7872
305
from math import * coordinate=[0,0] degree = 0 while True: dist,delta_degree = list(map(int,input().split(","))) if [dist,delta_degree]==[0,0]: break coordinate[0] += dist*sin(degree*pi/180) coordinate[1] += dist*cos(degree*pi/180) degree += delta_degree for c in coordinate: print(int(c))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,323
s712211690
p00016
u266872031
1482682170
Python
Python
py
Accepted
10
6716
259
import math x=0 y=0 deg=0 while(1): [a,b]=map(int,raw_input().split(',')) if a==0 and b==0: print int(x) print int(y) break else: x+=a*math.sin(deg*math.pi/180) y+=a*math.cos(deg*math.pi/180) deg+=b
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,324
s030583629
p00016
u711765449
1483965787
Python
Python3
py
Accepted
30
7896
347
# -*- coding:utf-8 -*- import math def walk(d,angle): x = d*math.cos(angle) y = d*math.sin(angle) p = [x,y] return p x,y,angle = 0,0,90 while True: d, a = map(int, input().split(",")) p = walk(d,math.radians(angle)) x += p[0] y += p[1] angle -= a if d == a == 0: break print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,325
s516324589
p00016
u661290476
1484810507
Python
Python3
py
Accepted
30
7864
269
from math import * def rad(n): return n * pi / 180 x, y = 0, 0 na = 90 while True: d, a = map(int, input().split(",")) if d == a == 0: print(int(x)) print(int(y)) break x += cos(rad(na)) * d y += sin(rad(na)) * d na -= a
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,326
s016777942
p00016
u078042885
1485288286
Python
Python3
py
Accepted
20
7832
195
from math import pi,sin,cos _x=_y=a=0 while 1: x,y=map(int,input().split(',')) if x==y==0:break r=a*pi/180 _x+=x*sin(r) _y+=x*cos(r) a+=y print(*map(int,[_x,_y]),sep='\n')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,327
s111703093
p00016
u032662562
1486614316
Python
Python3
py
Accepted
30
7704
246
import math deg = 90 x = 0.0 y = 0.0 while True: di,ai = map(int, input().split(',')) if di==0 and ai==0: break x += di*math.cos(deg*math.pi/180.0) y += di*math.sin(deg*math.pi/180.0) deg -= ai print("%d\n%d" % (x,y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,328
s772775461
p00016
u901080241
1488964425
Python
Python3
py
Accepted
20
7688
303
import math x = 0.0; y = 0.0; a = 90.0; while True : distance, angle = map(float, input().split(",")) if distance == 0 and angle == 0: break radangle = math.radians(a) x += math.cos(radangle) * distance y += math.sin(radangle) * distance a -= angle print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,329
s272703425
p00016
u728901930
1490787165
Python
Python3
py
Accepted
20
7812
275
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(int(x)) print(int(y)) #for i in sys.stdin: # a,b=map(int,i.split()) # print(gcd(a,b),lcm(a,b))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,330
s133582082
p00016
u462831976
1492709791
Python
Python3
py
Accepted
20
7776
557
# -*- coding: utf-8 -*- import sys import os from math import sin, cos import math def rotate_vector(v, rad): x = v[0] y = v[1] new_x = cos(rad) * x - sin(rad) * y new_y = sin(rad) * x + cos(rad) * y return (new_x, new_y) pos = [0, 0] dir = [0, 1] for s in sys.stdin: length, degree = map(int, s.split(',')) # move pos[0] += dir[0] * length pos[1] += dir[1] * length # rotate rad = math.radians(degree) rad *= -1 # rotated dir dir = rotate_vector(dir, rad) print(int(pos[0])) print(int(pos[1]))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,331
s624470418
p00016
u546285759
1492832951
Python
Python3
py
Accepted
30
7828
247
import math x = y = 0 theta = 90 while True: d, a = map(int, input().split(',')) if d==a==0: break x += d * math.cos(theta * math.pi / 180) y += d * math.sin(theta * math.pi / 180) theta -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,332
s515878482
p00016
u618637847
1494899755
Python
Python3
py
Accepted
20
7664
270
import math x = 0 y = 0 alpha = 90 while True: a, b = map(int, input().split(',')) if a == b == 0: break x += a * math.cos(alpha / 180 * math.pi) y += a * math.sin(alpha / 180 * math.pi) alpha -= b print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,333
s899071039
p00016
u362104929
1496269488
Python
Python3
py
Accepted
30
7884
387
import math def main(): p = [0, 0] x = math.radians(90) while True: d, angle = map(int, input().split(",")) if d == 0 and angle == 0: break p[0] += math.cos(x) * d p[1] += math.sin(x) * d x -= math.radians(angle) for i in (0,1): p[i] = int(p[i]) print(*p, sep="\n") if __name__ == "__main__": main()
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,334
s402810733
p00016
u905313459
1496405726
Python
Python3
py
Accepted
20
7968
242
import sys, cmath, math t = complex(0) a = math.pi/2 for line in sys.stdin: l = list(map(int, line.split(","))) if l == [0, 0]: break t += cmath.rect(l[0], a) a -= l[1]*math.pi/180 print(int(t.real)) print(int(t.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,335
s663548685
p00016
u957840591
1497346441
Python
Python3
py
Accepted
30
7856
551
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] if x >= 0: print(floor(x)) else: print(floor(x)+1) if y >= 0: print(floor(y)) else: print(floor(y)+1)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,336
s325334690
p00016
u519227872
1497444332
Python
Python3
py
Accepted
30
7900
296
from math import sin,cos,pi def rad(ang): return pi/180 * ang x = y = 0 ang = 90 while True: dist, next_ang = map(int, input().split(',')) x += dist * cos(rad(ang)) y += dist * sin(rad(ang)) ang += -1 * next_ang if dist == 0 and next_ang ==0: break print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,337
s022767054
p00016
u354053070
1501931012
Python
Python3
py
Accepted
40
7892
265
import cmath import math z = 0 + 0j theta = 90 while True: r, phi = map(int, input().split(",")) if r == phi == 0: break z += cmath.rect(r, math.radians(theta)) theta = (theta - phi) % 360 print(math.trunc(z.real)) print(math.trunc(z.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,338
s936921761
p00016
u584777171
1503144821
Python
Python3
py
Accepted
30
7848
287
import math A = math.radians(90) aD = 90 x = y = 0 while 1: user = input().split(",") r = int(user[0]) if r == 0 and int(user[1]) == 0: break x += r * math.cos(A) y += r * math.sin(A) aD -= int(user[1]) A = math.radians(aD) print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,339
s438771447
p00016
u957021183
1504765229
Python
Python3
py
Accepted
30
7964
459
# Aizu Problem 0016: Treasure Hunt # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") x, y = 0, 0 direction = 90 while True: d, t = [int(_) for _ in input().split(',')] if d == t == 0: break angle = direction * math.pi / 180 x += d * math.cos(angle) y += d * math.sin(angle) direction = (direction - t) % 360 print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,340
s170693220
p00016
u184989919
1505718479
Python
Python3
py
Accepted
20
7828
404
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)) print(int(y)) TreasureHunt()
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,341
s674391834
p00016
u197615397
1506691408
Python
Python3
py
Accepted
20
7952
242
from math import radians, sin, cos import sys x, y, a = 0, 0, 0 for l in sys.stdin.readlines()[:-1]: d, _a = map(int, l.split(",")) x += d * sin(radians(a)) y += d * cos(radians(a)) a += _a print(int(x), "\n", int(y), sep="")
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,342
s378146827
p00016
u299798926
1511589713
Python
Python3
py
Accepted
20
7964
278
import math x,y=(int(i) for i in input().split(',')) theta=1/2*math.pi Ansy=0 Ansx=0 while(x!=0 or y!=0): Ansy=Ansy+x*math.sin(theta) Ansx=Ansx+x*math.cos(theta) theta=theta-y/180*math.pi x,y=(int(i) for i in input().split(',')) print(int(Ansx)) print(int(Ansy))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,343
s841221101
p00016
u548155360
1512398499
Python
Python3
py
Accepted
30
5732
332
# 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(math.modf(x)[1])) print('{0:.0f}'.format(math.modf(y)[1]))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,344
s428528933
p00016
u203261375
1513469280
Python
Python3
py
Accepted
20
5716
310
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 * pi / 180 print(int(treasure_x)) print(int(treasure_y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,345
s851856756
p00016
u600263347
1514705606
Python
Python3
py
Accepted
30
5716
342
from math import radians,sin,cos,pi def main(): x = 0 y = 0 a = 0 while True: d,_a = map(int,input().split(",")) if(d == _a == 0): break x = x + d*cos(radians(a)) y = y + d*sin(radians(a)) a = a + _a print(int(y)) print(int(x)) if __name__ == '__main__': main()
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,346
s261467512
p00016
u273843182
1515043458
Python
Python3
py
Accepted
20
5716
199
import math X = Y = a = 0 while True: x,y = map(int,input().split(',')) if x == y == 0: break r = a * math.pi / 180 X += x*math.sin(r) Y += x*math.cos(r) a+=y print(*map(int,(X,Y)),sep='\n')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,347
s370182547
p00016
u024715419
1515136916
Python
Python3
py
Accepted
20
5700
247
import math x = 0.0 y = 0.0 ang = 0.5*math.pi while True: d, a = map(float, input().split(",")) if d == 0 and a == 0: break x += d*math.cos(ang) y += d*math.sin(ang) ang += math.radians(-a) print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,348
s661630406
p00016
u764789069
1515342007
Python
Python
py
Accepted
10
4780
305
import math sum_x,sum_y,dig=0,0,0 while True: d,a = map(int,raw_input().split(",")) if d ==0 and a ==0: break else: x = d * math.sin(dig) y = d * math.cos(dig) sum_x += x sum_y += y dig = dig + math.radians(a) print int(sum_x) print int(sum_y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,349
s881436751
p00016
u846136461
1516240428
Python
Python
py
Accepted
10
4808
355
# coding: utf-8 import math def RadToDeg(rad): return rad*180/math.pi def DegToRad(deg): return deg*math.pi/180 deg = 90 x = 0. y = 0. while True: d, theta = map(int, raw_input().split(",")) if d == 0 and theta == 0: break else: x += d * math.cos(DegToRad(deg)) y += d * math.sin(DegToRad(deg)) deg -= theta print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,350
s176420971
p00016
u043254318
1516466201
Python
Python3
py
Accepted
20
5716
436
import math def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = list(get_input()) x,y = 0,0 arg = 90 for l in range(len(N)): d,a = [int(i) for i in N[l].split(",")] if d == 0 and a == 0: break x = x + d * math.cos(math.radians(arg)) y = y + d * math.sin(math.radians(arg)) arg = arg - a print(math.trunc(x)) print(math.trunc(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,351
s034730654
p00016
u546285759
1516654241
Python
Python3
py
Accepted
20
5708
242
import math x = y = 0 ang = 90 while True: d, a = map(int, input().split(',')) if d == a == 0: break rad = ang * math.pi / 180 x += d * math.cos(rad) y += d * math.sin(rad) ang -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,352
s409888115
p00016
u150984829
1516931533
Python
Python3
py
Accepted
20
5776
158
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),sep='\n')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,353
s836238440
p00016
u150984829
1516931622
Python
Python3
py
Accepted
30
5764
156
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)) print(int(z.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,354
s080106871
p00016
u150984829
1516931632
Python
Python3
py
Accepted
20
5768
156
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)) print(int(z.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,355
s767857086
p00016
u150984829
1516931735
Python
Python3
py
Accepted
20
5772
161
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),'\n',int(z.imag),sep='')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,356
s851284976
p00016
u553148578
1523591489
Python
Python3
py
Accepted
20
5716
201
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')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,357
s850220631
p00016
u166871988
1523753111
Python
Python3
py
Accepted
20
5740
311
import math x=0 y=0 d=90 cos=lambda x:round(math.cos(math.radians(x)),10) sin=lambda x:round(math.sin(math.radians(x)),10) while True: try:h,r=[int(i) for i in input().split(",")] except:break if h==0 and r==0:break x+=h*cos(d) y+=h*sin(d) d+=-r print("{0}\n{1}".format(int(x),int(y)))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,358
s156137625
p00016
u724548524
1525747985
Python
Python3
py
Accepted
20
5712
232
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(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,359
s709678858
p00016
u136916346
1528958120
Python
Python3
py
Accepted
20
5708
205
import math X=0 Y=0 th=0 while 1: d,a=list(map(int,input().split(","))) if not a and not d:break Y+=d*math.cos(math.radians(th)) X+=d*math.sin(math.radians(th)) th+=a print(int(X)) print(int(Y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,360
s454685225
p00016
u847467233
1529226366
Python
Python3
py
Accepted
20
5744
610
# AOJ 0016 Treasure Hunt # Python3 2018.6.15 bal4u import math PI = 3.1415926535897932384626433832795 M = 0.01745329251994329576923690768489 EPS = 1e-8 r, q, f = 0, 90*M, 0 while True: d, a = list(map(int, input().split(','))) if d == 0 and a == 0: break r2 = math.sqrt(r*r + d*d - 2*r*d*math.cos(PI - math.fabs(f))) if math.fabs(r) < EPS or math.fabs(r2) < EPS: q2 = q - f f = a * M else: t = math.acos((r*r + r2*r2 - d*d) / (2 * r*r2)); if f >= 0: q2 = q - t f += a*M - t else: q2 = q + t f += a*M + t r = r2 q = q2 print(int(r * math.cos(q)), int(r * math.sin(q)), sep='\n')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,361
s374423848
p00016
u647766105
1351615115
Python
Python
py
Accepted
10
4432
237
import sys from math import * x=0.0 y=0.0 dir=90 for line in sys.stdin: r,t=map(int,line.split(',')) if r==0 and t==0:break x=x+r*cos(2*pi*(dir%360)/360) y=y+r*sin(2*pi*(dir%360)/360) dir+=-t print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,362
s472332812
p00016
u719737030
1351669551
Python
Python
py
Accepted
10
4444
284
import math x=0.0 y=0.0 d=90.0 while True: list = [float(i) for i in raw_input().split(",")] if list[0]==0 and list[1]==0: break x += list[0]*math.cos(math.radians(d)) y += list[0]*math.sin(math.radians(d)) d += -list[1] for i in (x,y): print int(i)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,363
s274027241
p00016
u280179677
1355420768
Python
Python
py
Accepted
20
5672
421
from math import radians, sin, cos def datasets(): while True: ss = raw_input().split(',') dis = int(ss[0]) deg = int(ss[1]) if dis == deg == 0: return yield dis, deg # result x = 0 y = 0 # current angle ang = radians(90) for dis, deg in datasets(): rad = radians(deg) x += dis * cos(ang) y += dis * sin(ang) ang -= rad print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,364
s191715413
p00016
u419407022
1356086413
Python
Python
py
Accepted
10
4432
321
import math nowx = 0 nowy = 0 nowa = 90 while True: (d,a) = [int(i) for i in raw_input().split(',')] if(d == a == 0): print int(nowx) print int(nowy) break else: nowx += math.cos(nowa / 180.0 * math.pi) * d nowy += math.sin(nowa / 180.0 * math.pi) * d nowa -= a
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,365
s867894007
p00016
u126791750
1357124639
Python
Python
py
Accepted
20
4420
215
import math a = 0 b = 0 r = 0 while True: n,m = map(int,raw_input().split(',')) if n==0 and m==0: break a += n * math.sin(math.radians(r)) b += n * math.cos(math.radians(r)) r += m print(int(a)) print(int(b))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,366
s274761350
p00016
u782850731
1362097452
Python
Python
py
Accepted
20
4488
448
from __future__ import (absolute_import, division, print_function, unicode_literals) from sys import stdin from math import radians from cmath import rect p = 0+0j prev_angle = radians(-90) for line in stdin: m, next_angle = (int(i) for i in line.split(',')) if not (m or next_angle): break p += rect(m, -prev_angle) prev_angle += radians(next_angle) print('{}\n{}'.format(int(p.real), int(p.imag)))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,367
s164091574
p00016
u575065019
1362256941
Python
Python
py
Accepted
10
4416
230
import math rad=0 x=0 y=0 while True: try: r,c=map(int,raw_input().split(',')) except EOFError: break x+=math.cos(rad)*r y+=math.sin(rad)*r rad+=c*math.pi/180 print int(y) print int(x)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,368
s247468636
p00016
u282635979
1363434217
Python
Python
py
Accepted
90
10716
249
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.fd(x[0]) kame.right(x[1]) continue print int(kame.xcor()) print int(kame.ycor())
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,369
s788758640
p00016
u743065194
1363920055
Python
Python
py
Accepted
10
4440
284
''' Created on Mar 22, 2013 @author: wukc ''' from sys import stdin import math x,y=0,0 t=math.radians(90) for l in stdin: r,d=map(int,l.split(",")) if (r,d)==(0,0): break x+=r*math.cos(t) y+=r*math.sin(t) t+=math.radians(-d) print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,370
s083153163
p00016
u542421762
1368181433
Python
Python
py
Accepted
10
4460
663
import sys import math class Walker: def __init__(self): self.x = 0.0 self.y = 0.0 self.deg = 0.0 def walk(self, dis): dis = float(dis) self.x += dis * math.sin(math.radians(self.deg)) self.y += dis * math.cos(math.radians(self.deg)) def turn(self, deg): self.deg += float(deg) walker = Walker() #input_file = open(sys.argv[1], "r") #for line in input_file: for line in sys.stdin: d = map((lambda x: int(x)), line.split(',')) dis = d[0] deg = d[1] if dis == 0 and deg == 0: break walker.walk(dis) walker.turn(deg) print int(walker.x) print int(walker.y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,371
s199281703
p00016
u912237403
1377769409
Python
Python
py
Accepted
20
4444
306
import math pi=3.14159265358979 def radians(x): return 1.0*x/180*pi x = 0 y = 0 theta = radians(90) while True: a, b = map(float, raw_input().split(',')) if a==0 and b==0: break x += a * math.cos(theta) y += a * math.sin(theta) theta += radians(-b) print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,372
s681093534
p00016
u912237403
1377769651
Python
Python
py
Accepted
10
4436
271
import math pi=3.14159265358979 x = 0 y = 0 theta = math.radians(90) while True: a, b = map(float, raw_input().split(',')) if a==0 and b==0: break x += a * math.cos(theta) y += a * math.sin(theta) theta += math.radians(-b) print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,373
s922301784
p00016
u912237403
1377769761
Python
Python
py
Accepted
10
4436
251
import math x = 0 y = 0 theta = math.radians(90) while True: a, b = map(float, raw_input().split(',')) if a==0 and b==0: break x += a * math.cos(theta) y += a * math.sin(theta) theta += math.radians(-b) print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,374
s756149259
p00016
u813384600
1379499282
Python
Python
py
Accepted
10
4432
266
import math x, y, angle = 0, 0, 0 while True: a, b = map(float, raw_input().split(',')) if (a, b) == (0, 0): break x += a * math.sin(angle * (math.pi / 180)) y += a * math.cos(angle * (math.pi / 180)) angle += b print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,375
s153712081
p00016
u523886269
1381070112
Python
Python
py
Accepted
20
4472
883
#! /usr/bin/python import math def main(): turtle = Turtle(0, 0, 0, 1) while True: input = raw_input() if input == '0,0': break args = input.strip().split(',') dist = int(args[0]) degree = int(args[1]) rad = 2 * math.pi * degree / 360.0 turtle.move(dist) turtle.rotate(rad) print("%d" % (turtle.x)) print("%d" % (turtle.y)) class Turtle: def __init__(self, x, y, vx, vy): self.x = x self.y = y self.vx = vx self.vy = vy self.normalize_velocity() def move(self, dist): self.x += self.vx * dist self.y += self.vy * dist def normalize_velocity(self): vx = self.vx vy = self.vy v = math.sqrt(vx * vx + vy * vy) self.vx = vx / v self.vy = vy / v def rotate(self, theta): vx = self.vx vy = self.vy self.vx = vx * math.cos(theta) + vy * math.sin(theta) self.vy = -vx * math.sin(theta) + vy * math.cos(theta) main()
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,376
s073295946
p00016
u547057305
1384591796
Python
Python
py
Accepted
10
4424
314
from math import sin, cos, radians cl = [0, 0] cd = 0 while True: o = input() if o == (0, 0): break cl[0] += o[0] * sin(radians(cd)) cl[1] += o[0] * cos(radians(cd)) cd += o[1] if 180 <= cd: cd -= 360 elif cd <= -180: cd += 360 for x in cl: print(int(x))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,377
s937337134
p00016
u230836528
1392305085
Python
Python
py
Accepted
10
4428
558
# -*- coding: utf-8 -*- import sys from math import * lineNumber = 0 coord = [0, 0] theta = 0.5 * pi #for line in [ "56,65", "97,54", "64,-4", "55,76", "42,-27", "43,80", "87,-86", "55,-6", "89,34", "95,5", "0,0"]: 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(coord[0]) print int(coord[1])
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,378
s315992510
p00016
u633068244
1393363094
Python
Python
py
Accepted
10
4416
261
import math x = 0.0 y = 0.0 theta = 90.0 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)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,379
s609972221
p00016
u858885710
1393932036
Python
Python
py
Accepted
20
4420
269
from math import sin,cos,pi pos = [0,0] d = 0 cmd = map(int, raw_input().split(',')) while cmd != [0,0]: pos[0] += cmd[0]*sin(pi*d/180) pos[1] += cmd[0]*cos(pi*d/180) d += cmd[1] cmd = map(int, raw_input().split(',')) for c in map(int, pos): print c
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,380
s646999601
p00016
u912237403
1393941974
Python
Python
py
Accepted
10
4424
213
import math x=0 y=0 theta=90 while 1: a,b=map(float,raw_input().split(',')) if a==0 and b==0:break r=math.radians(theta) x+=a*math.cos(r) y+=a*math.sin(r) theta-=b print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,381
s952764132
p00016
u491763171
1396396346
Python
Python
py
Accepted
10
4412
247
from math import cos, sin, radians x, y, d = 0, 0, 90 while 1: a, b = map(int, raw_input().split(',')) if a == b == 0: break x += a * cos(radians(d)) y += a * sin(radians(d)) d = (d - b) % 360 print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,382
s712010402
p00016
u246033265
1396614484
Python
Python
py
Accepted
10
4408
241
import math x, y, a = 0, 0, math.radians(90) while True: p, q = map(int, raw_input().split(',')) if p == 0 and q == 0: break x += math.cos(a) * p y += math.sin(a) * p a -= math.radians(q) print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,383
s725657823
p00016
u436634575
1401135587
Python
Python3
py
Accepted
30
6864
225
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)) print(int(z.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,384
s567169168
p00016
u557208833
1402208381
Python
Python
py
Accepted
20
4424
357
import sys import math def readnums(): for line in sys.stdin: yield map(int,line.split(',')) [x,y] = [0.0,0.0] degree = 90 for [steps,delta_d] in readnums(): if steps == 0 and degree == 0: break phi = math.radians(degree) x += steps*math.cos(phi) y += steps*math.sin(phi) degree -= delta_d print int(x) print int(y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,385
s054913636
p00016
u747915832
1597132178
Python
Python3
py
Accepted
20
5716
259
import math A = 90 North = 0 East = 0 while True: d, a = map(int, input().split(',')) if d==0 and a==0: break North += d * math.sin(math.radians(A)) East += d * math.cos(math.radians(A)) A -= a print(int(East)) print(int(North))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,386
s648254972
p00016
u187074069
1593274805
Python
Python3
py
Accepted
20
5720
337
import math posx = 0 posy = 0 s = math.radians(90) while True: lst = list(map(int, input().split(","))) if lst == [0, 0]: break n = lst[0] movex = n* math.cos(s) movey = n* math.sin(s) posx = posx + movex posy = posy + movey s = s - math.radians(lst[1]) print(int(posx)) print(int(posy))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,387
s214759531
p00016
u260980560
1588730675
Python
Python3
py
Accepted
20
5724
316
from math import radians, cos, sin, ceil, floor g = 90 x = y = 0 while 1: d, a = map(int, input().split(",")) if d == 0: break t = radians(g) x += cos(t) * d y += sin(t) * d g -= a x = floor(x) if x > 0 else ceil(x) y = floor(y) if y > 0 else ceil(y) print("%d" % x) print("%d" % y)
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,388
s006727905
p00016
u630911389
1584120027
Python
Python3
py
Accepted
20
5724
397
import math x = y = 0 # 初めは90から totalAngle = 90 while(1): try: num,angle = (int(x) for x in input().split(",")) if num == 0:break rad = math.radians(totalAngle) y += math.sin(rad) * num x += math.cos(rad) * num # 右周り+だから-になる totalAngle -= angle except EOFError: break print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,389
s911542483
p00016
u350155409
1572695017
Python
Python3
py
Accepted
20
5716
241
import sys import math x,y,t = 0,0,0 for s in sys.stdin: a,b = map(int,s.split(',')) if a==0 and b==0: break x += a*math.sin(math.radians(t)) y += a*math.cos(math.radians(t)) t += b print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,390
s031065994
p00016
u803862921
1570856573
Python
Python3
py
Accepted
20
5724
253
from math import * x = 0 y = 0 a = 0 while True: l, r = [int(i) for i in input().split(",")] if l == 0 and r == 0: break x += l * sin(radians(a)) y += l * cos(radians(a)) a = (a+r)%360 print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,391
s209818840
p00016
u629170852
1568814691
Python
Python3
py
Accepted
20
5728
291
import sys import math N=[] for l in sys.stdin: a=list(map(int,l.split(","))) N.append(a) x=0 y=0 n=90 for d in N: if d[0]==0 and d[1]==0: break x=x+d[0]*math.cos(math.radians(n)) y=y+d[0]*math.sin(math.radians(n)) #print(x,y) n-=d[1] print(int(x), int(y), sep="\n")
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,392
s089038507
p00016
u824708460
1566191660
Python
Python3
py
Accepted
20
5704
249
import math x, y, now = 0, 0, 90 while 1: d, a = map(float, input().split(',')) if d == 0 and a == 0: break x += d*math.cos(now * math.pi / 180) y += d*math.sin(now * math.pi / 180) now -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,393
s120080175
p00016
u427219397
1564928483
Python
Python3
py
Accepted
20
5720
223
import math X = Y = a = 0 while True: x,y = map(int,input().split(',')) if x == y == 0: break r = a * math.pi / 180 X += x*math.sin(r) Y += x*math.cos(r) a+=y print(*map(int,(X,Y)),sep='\n')
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,394
s311303369
p00016
u548252256
1564908512
Python
Python3
py
Accepted
20
5712
269
import math if __name__ == '__main__': x = y = 0 deg = 90 while True: d,a = map(int,input().split(",")) if d == 0 and a == 0: break x += math.cos(math.radians(deg)) * d y += math.sin(math.radians(deg)) * d deg -= a print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,395
s262325021
p00016
u647694976
1564455005
Python
Python3
py
Accepted
30
5716
226
import math x,y=0,0 angle=math.pi/2 while True: d,a=map(int,input().split(",")) if (d,a)==(0,0): break y +=math.cos(angle)*d x +=math.sin(angle)*d angle -=a*math.pi/180 print(int(y)) print(int(x))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,396
s517407116
p00016
u013648252
1563678436
Python
Python3
py
Accepted
20
5776
243
import sys, cmath, math t = complex(0) a = math.pi/2 for line in sys.stdin: l = list(map(int, line.split(","))) if l == [0, 0]: break t += cmath.rect(l[0], a) a -= l[1]*math.pi/180 print(int(t.real)) print(int(t.imag))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,397
s362973904
p00016
u313600138
1562856484
Python
Python3
py
Accepted
20
5720
214
import math x=0 y=0 face=math.pi/2 while True: d,a = map(int,input().split(",")) if d==0 and a==0: break x+=math.cos(face)*d y+=math.sin(face)*d face -=a*math.pi/180 print(int(x)) print(int(y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,398
s598298428
p00016
u625806423
1557059884
Python
Python3
py
Accepted
20
5740
272
import math PI = 4.0 * math.atan(1.0) x = 0 y = 0 angle = 90.0 * PI / 180.0 while True: a,b = map(int, input().split(',')) if a == 0 and b == 0: print(int(x)) print(int(y)) break x += a*math.cos(angle) y += a*math.sin(angle) angle -= b * PI / 180.0
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,399
s259702652
p00016
u563075864
1542539708
Python
Python3
py
Accepted
20
5728
287
deg = 0.0 x = 0.0 y = 0.0 from math import pi, cos,sin while(1): a,b = [int(i) for i in input().split(",")] if a == 0.0 and b==0.0: print(int(y)) print(int(x)) break else: x += a*cos(deg*pi/180) y += a*sin(deg*pi/180) deg += b
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,400
s480414459
p00016
u067299340
1542166969
Python
Python3
py
Accepted
20
5720
447
import math class Pos(): x = 0 y = 0 direction = math.radians(90) cur_pos = Pos() while True: d, a = [int(i) for i in input().split(",")] if d == 0 and a == 0: break cur_pos.x += d * math.cos(cur_pos.direction) cur_pos.y += d * math.sin(cur_pos.direction) cur_pos.direction -= math.radians(a) #print(cur_pos.x, cur_pos.y, math.degrees(cur_pos.direction)) print(int(cur_pos.x)) print(int(cur_pos.y))
p00016
<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>
56,65 97,54 64,-4 55,76 42,-27 43,80 87,-86 55,-6 89,34 95,5 0,0
171 -302
6,401