Problem:


Treasure Hunt

When a boy was cleaning up after his grand father passing, he found an old paper:

Stand facing to north from "Sanbonmatsu", and go according to the following steps. You will come across a treasure at the end point.

30, 10
50, -40
20, 15
.
.

-->

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". 

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.

For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers d (the first integer) and t (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate (x, y) 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.

You can assume that d ≤ 100 and -180 ≤ t ≤ 180.

Input

A sequence of pairs of integers d and t which end with "0,0".

Output

Print the integer portion of x and y in a line respectively.

Sample Input

56,65
97,54
64,-4
55,76
42,-27
43,80
87,-86
55,-6
89,34
95,5
0,0

Output for the Sample Input

171
-302



Sample input:
56,65
97,54
64,-4
55,76
42,-27
43,80
87,-86
55,-6
89,34
95,5
0,0


Sample output:
171
-302

Submission status: Wrong Answer

Solution code:
import math
now_r=0
now_x=0
now_y=0

while True:
    n,r=map(int,raw_input().split(","))
    if n==0 and r==0:
        break
    now_x+=n*math.sin((now_r/180.0)*math.pi)
    now_y+=n*math.cos((now_r/180.0)*math.pi)
    now_r+=r

print "{0:.0f} {1:.0f}".format(now_x,now_y)

Submission status: Wrong Answer

Solution code:
import math
now_r=0
now_x=0
now_y=0

while True:
    n,r=map(int,raw_input().split(","))
    if n==0 and r==0:
        break
    now_x+=n*math.sin((now_r/180.0)*math.pi)
    now_y+=n*math.cos((now_r/180.0)*math.pi)
    now_r+=r

print "{0:.0f}\n{1:.0f}".format(now_x,now_y)

Submission status: Wrong Answer

Solution code:
import math
now_r=0
now_x=0
now_y=0

while True:
    n,r=map(int,raw_input().split(","))
    if n==0 and r==0:
        break
    now_x+=n*math.sin((now_r/180.0)*math.pi)
    now_y+=n*math.cos((now_r/180.0)*math.pi)
    now_r+=r

print math.floor(now_x)
print math.floor(now_y)

Submission status: Wrong Answer

Solution code:
import math
x=0
y=0
angle=0
while True:
    r,c=map(int, input().split(","))
    if r == c == 0:
        break

    x += r*math.cos(-angle)
    y += r*math.sin(-angle)
    angle += c

print(x)
print(y)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
import math

def walk(x, y, distance, angle, next_angle):
    radian = math.radians(angle)
    _x = Decimal(distance * math.cos(radian) + x)
    x = round(_x, 6)
    _y = Decimal(distance * math.sin(radian) + y)
    y = round(_y, 6)
    angle = angle - next_angle
    return x, y, angle
    
x = 0
y = 0
angle = 90
while True:
    input_line = raw_input()
    distance = int(input_line.split(',')[0])
    next_angle = int(input_line.split(',')[1])
    if distance == 0 and next_angle == 0: break
    x, y, angle = walk(x, y, distance, angle, next_angle)
print int(x), int(y)

Submission status: Wrong Answer

Solution code:
import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(m.sqrt(x**2+y**2)))
print(d)

Submission status: Wrong Answer

Solution code:
import math

x, y, r = 0, 0, 90
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += r * math.cos(math.radians(r))
    y += r * math.sin(math.radians(r))
    r -= t
print(int(x))
print(int(y))

Submission status: Wrong Answer

Solution code:
import math

x, y, r = 0, 0, 90
while True:
    d, t = map(float, input().split(","))
    if d == t == 0:
        break
    x += r * math.cos(math.radians(r))
    y += r * math.sin(math.radians(r))
    r -= t
print(int(x))
print(int(y))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import math

curdeg = 90
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += -step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print("{:.0f}".format(xstep))
print("{:.0f}".format(ystep))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print("{:.0f}".format(xstep))
print("{:.0f}".format(ystep))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 


print("{:.0f}".format(ystep))
print("{:.0f}".format(xstep))

Submission status: Wrong Answer

Solution code:
from math import *

x , y = 0, 0
rad = radians(90)
while 1:
    d, t = map(int, raw_input().split(','))
    if d == 0: break
    x = x + cos(rad) * d
    y = y + sin(rad) * d
    rad -= radians(t)
print x
print y

Submission status: Wrong Answer

Solution code:
from math import sin,cos,pi
x = 0
y = 0
ca = pi/2
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca)
        y += d*sin(ca)
        ca -= a*pi/180
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y))

Submission status: Wrong Answer

Solution code:
from math import sin,cos,pi
x = 0
y = 0
ca = pi/2
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca)
        y += d*sin(ca)
        ca -= a*pi/180
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y),end="")

Submission status: Wrong Answer

Solution code:
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y))

Submission status: Wrong Answer

Solution code:
import sys
import math as mas

x,y,d=0,0,90
for t in sys.stdin:
	a,b=map(int,t.split(','))
	if a==b==0:break
	x+=a*mas.cos(mas.radians(d))
	y+=a*mas.sin(mas.radians(d))
	d-=b
print(x)
print(y)
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(A[i] * pi / 180)
    y = y + D[i] * sin(A[i] * pi / 180)
print(x,y)

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(A[i] * pi / 180)
    y = y + D[i] * sin(A[i] * pi / 180)
print(x)
print(y)

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(A[i] * pi / 180)
    y = y + D[i] * sin(A[i] * pi / 180)
print(floor(x))
print(floor(y))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(A[i] * pi / 180)
    y = y - D[i] * sin(A[i] * pi / 180)
print(floor(x))
print(floor(y))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = floor(x + D[i] * cos(A[i] * pi / 180))
    y = floor(y - D[i] * sin(A[i] * pi / 180))
print(x)
print(y)

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x += D[i] * cos(-sum_a * pi / 180)
    y += D[i] * sin(-sum_a * pi / 180)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    sum_a += A[i]
print(round(x))
print(round(y))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-5):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-5):
        y=round(y)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Submission status: Wrong Answer

Solution code:
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-7):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-7):
        y=round(y)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Submission status: Wrong Answer

Solution code:
import sys
import math

def TreasureHunt():
    x,y=(0.0,0.0)
    alpha=90
    
    for line in sys.stdin:
        a,b=list(map(int,line.split(',')))
        if a==0 and b==0:
            break
        
        x+=a*math.cos(alpha/180.0*math.pi)
        y+=a*math.sin(alpha/180.0*math.pi)
        alpha=(alpha-b+360)%360

    print(int(x),int(y))

        
        
            
TreasureHunt()

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import math

x = 0
y = 0
direction = math.pi/2
while True:
    d, a = map(int, input().split(','))
    if d == 0 and a == 0:
        break
    x += d * math.cos(direction)
    y += d * math.sin(direction)
    direction -= a*math.pi/180
print('{0:.0f}'.format(x))
print('{0:.0f}'.format(y))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math

a, b = map(int, raw_input().split(","))
c = 0
x = 0
y = 0

while a != 0 and b != 0:
    x += a * math.sin(float(2 * math.pi * c / 360))
    y += a * math.cos(float(2 * math.pi * c / 360))
    c += b
    a, b = map(int, raw_input().split(","))

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math

a, b = map(int, raw_input().split(","))
c = 0
x = 0
y = 0

while a != 0 and b != 0:
    x += a * math.sin(float(2 * math.pi * c / 360))
    y += a * math.cos(float(2 * math.pi * c / 360))
    c -= b
    a, b = map(int, raw_input().split(","))

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math

a, b = map(int, raw_input().split(","))
c = 0
x = 0
y = 0

while a != 0 and b != 0:
    x += a * math.sin(2 * math.pi * c / 360)
    y += a * math.cos(2 * math.pi * c / 360)
    c += b
    a, b = map(int, raw_input().split(","))

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
treasure_x, treasure_y = 0, 0

while True:
    x, y = map(int, input().split(','))

    if x == 0 and y == 0:
        break

    treasure_x += x
    treasure_y += y

print(treasure_x)
print(treasure_y)

Submission status: Wrong Answer

Solution code:
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = 90

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    radian_a = a * 2 * pi / 180

    treasure_x += d * cos(radian_a)
    treasure_y += d * sin(radian_a)

print(int(treasure_x))
print(int(treasure_y))

Submission status: Wrong Answer

Solution code:
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle += a * 2 * pi / 180


print(int(treasure_x))
print(int(treasure_y))

Submission status: Wrong Answer

Solution code:
56,65
97,54
64,-4
55,76
42,-27
43,80
87,-86
55,-6
89,34
95,5
0,0

Submission status: Wrong Answer

Solution code:
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))

Submission status: Wrong Answer

Solution code:
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')

Submission status: Wrong Answer

Solution code:
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=',')

Submission status: Wrong Answer

Solution code:
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=',')

Submission status: Wrong Answer

Solution code:
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(x), int(y)))

Submission status: Wrong Answer

Solution code:
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(math.modf(x)[1]), int(math.modf(y)[1])))

Submission status: Wrong Answer

Solution code:
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == 0 and t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(math.modf(x)[1]), int(math.modf(y)[1])))

Submission status: Wrong Answer

Solution code:
import math
pi = math.acos(-1)
d0,t0 = map(int,raw_input().split(','))
pos=[0,d0,90-t0]#[x,y,digree]
while True:
    d,t= map(int,raw_input().split(','))
    if d!=0 and t!=0:
        pos[0]+=d*math.cos(float(pos[2])*pi/180)
        pos[1]+=d*math.sin(float(pos[2])*pi/180)
        pos[2]-=t
    else:
        print int(pos[0]),'\n',int(pos[1])
        break

Submission status: Wrong Answer

Solution code:
import math
pi = math.pi
pos=[0,0,90]#[x,y,digree]
while True:
    d,t= map(int,raw_input().split(','))
    if d!=0 and t!=0:
        pos[0]+=d*math.cos(math.radians(pos[2]))
        pos[1]+=d*math.sin(math.radians(pos[2]))
        pos[2]-=t
    else:
        print int(pos[0]),'\n',int(pos[1])
        break

Submission status: Wrong Answer

Solution code:
import turtle
kame = turtle.Turtle()
kame.speed(0)
while True:
	x = map(int,raw_input().split(','))
	if x[0] == 0 and x[1] == 0:
		break
	else:
		kame.right(x[0])
		kame.fd(x[1])
		continue
print kame.xcor()
print kame.ycor()

Submission status: Wrong Answer

Solution code:
import turtle
kame = turtle.Turtle()
kame.speed(0)
kame.left(90)
while True:
	x = map(int,raw_input().split(','))
	if x[0] == 0 and x[1] == 0:
		break
	else:
		kame.right(x[0])
		kame.fd(x[1])
		continue
print kame.xcor()
print kame.ycor()

Submission status: Wrong Answer

Solution code:

import math

x = 0
y = 0

while True:
    a = map(int,raw_input().split(','))

    if a[0] == 0:
        if a[1] == 0:
            break

    x += a[0] * math.sin(a[1])
    y += a[0] * math.cos(a[1])

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
import math

x = 0
y = 0

while True:
    a = map(float,raw_input().split(','))

    if a[0] == 0:
        if a[1] == 0:
            break

    x += a[0] * math.cos(a[1]/180 * math.pi)
    y += a[0] * math.sin(a[1]/180 * math.pi)

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
import math

x = 0
y = 0

while True:
    leng,ang = map(float,raw_input().split(','))

    if leng == 0:
        if ang == 0:
            break

    x += leng * math.sin(ang/180 * math.pi)
    y += leng * math.cos(ang/180 * math.pi)

print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
import math

cl = [0, 0]
cd = 0

while True:
    o = input()
    if o == (0, 0):
        break

    cl[0] += o[0] * math.sin(cd)
    cl[1] += o[0] * math.cos(cd)
    cd += math.radians(o[1])

for x in cl:
    print(int(math.floor(x)))

Submission status: Wrong Answer

Solution code:
anslist=[0,0]
while True:
  inputlist=map(int,raw_input().split(","))
  if(inputlist[0]==0 and inputlist[1]==0):
    break
  anslist[0]+=inputlist[0]
  anslist[1]+=inputlist[1]
print anslist[0]
print anslist[1]

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
from math import *

lineNumber = 0
coord = [0, 0]
theta = 0.5 * pi
#for line in [ 
for line in sys.stdin.readlines():
    lineNumber += 1

   
    # get data
    List = map(float, line.strip().split(","))

    # set data
    forward = List[0]
    d_theta = List[1] / 180.0 * pi

    # solve
    coord[0] += forward * cos(theta)
    coord[1] += forward * sin(theta)
    theta += d_theta

print int(ceil(coord[0]))
print int(ceil(coord[1]))

Submission status: Wrong Answer

Solution code:
import math
x = 0.0
y = 0.0
theta = 0
while True:
    m, r = map(int, raw_input().split(","))
    if m == 0 and r == 0:
        break
    theta += r
    rad = theta/180*math.pi
    x += m*math.cos(rad)
    y += m*math.sin(rad)
    
print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
import math
x = 0.0
y = 0.0
theta = 90
while True:
    m, r = map(int, raw_input().split(","))
    if m == 0 and r == 0:
        break
    rad = theta/180*math.pi
    x += m*math.cos(rad)
    y += m*math.sin(rad)
    theta += -r
    
print int(x)
print int(y)

Submission status: Wrong Answer

Solution code:
from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(int, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg += d
print(-int(z.real), int(z.imag))

Submission status: Wrong Answer

Solution code:
from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(int, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg += d
print(int(z.real), int(z.imag))

Submission status: Wrong Answer

Solution code:
from math import radians, sin, cos

x = y = 0
deg = 90
while True:
    r, d = map(int, input().split(','))
    if r == d == 0: break
    x += r * cos(radians(deg))
    y += r * sin(radians(deg))
    deg -= d
print(int(x), int(y))

Submission status: Wrong Answer

Solution code:
from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(int, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg -= d
print(int(z.real), int(z.imag))

Submission status: Wrong Answer

Solution code:
from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(float, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg -= d
print(int(z.real), int(z.imag))

Submission status: Accepted

Solution code:
import math
x, y = 0, 0
angle = math.pi / 2
while True:
  d, a = map(int, input().split(","))
  if (d, a) == (0, 0):
    break
  x += math.cos(angle) * d
  y += math.sin(angle) * d
  angle -= a * math.pi / 180
print(int(x), int(y), sep="\n")

Submission status: Accepted

Solution code:
import math
import cmath

coordinates = 0
ang = 90
while True:
    line = list(map(float, input().split(",")))
    if line[0] == 0 and line[1] == 0:
        break

    coordinates += cmath.rect(line[0], math.radians(ang))
    ang -= line[1]

print(int(coordinates.real))
print(int(coordinates.imag))

Submission status: Accepted

Solution code:
import math

x, y = 0, 0
angle = 90

while True:
  line = map(int, raw_input().split(','))
  if line[0] == 0 and line[1] == 0: break
  radian = math.radians(angle)
  x += math.cos(radian) * line[0]
  y += math.sin(radian) * line[0]
  angle -= line[1]

print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
import math
x = 0
y = 0
degree = 0
while(True):
    a = map(int, raw_input().split(","))
    if(a[0] == 0 and a[1] == 0):
        break
    x += a[0] * math.sin(math.radians(degree))
    y += a[0] * math.cos(math.radians(degree))
    degree += a[1]
print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys
import math

def move(point,n,arg):
  return [ point[0]+n*arg[0], point[1]+n*arg[1] ]

theta = 90
p = [0.0,0.0]
for s in sys.stdin:
  d = map(int , s.split(","))
  arg = [ math.cos(theta*math.pi/180), math.sin(theta*math.pi/180) ]
  p = move(p,d[0],arg)
  theta -= d[1]
  if d == [0,0]:
    for e in p:
      print int(e)

Submission status: Accepted

Solution code:
#!/usr/bin/python
# AOJ
# 0016

import math

degree = 90
x = 0
y = 0

while True:
    a, b = map(int, input().split(','))
    if a is 0 and b is 0: break
    x += a * math.cos(math.radians(degree))
    y += a * math.sin(math.radians(degree))
    degree -= b
    if degree > 360:
        degree -= 360
    elif degree < 0:
        degree += 360
print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
import sys
f = sys.stdin
import math, cmath

direction = 1j
location = 0 + 0j
while True:
    step, degrees = map(int, f.readline().split(','))
    location += direction * step
    direction *= cmath.rect(1, math.radians(-degrees))
    if step == 0:
        break
print(int(location.real))
print(int(location.imag))

Submission status: Accepted

Solution code:
import math
now_r=0
now_x=0
now_y=0

while True:
    n,r=map(int,raw_input().split(","))
    if n==0 and r==0:
        break
    now_x+=n*math.sin((now_r/180.0)*math.pi)
    now_y+=n*math.cos((now_r/180.0)*math.pi)
    now_r+=r
print int(now_x)
print int(now_y)

Submission status: Accepted

Solution code:
import math
x=0
y=0
angle=0
while True:
    r,c=map(int, input().split(","))
    if r == c == 0:
        break

    y += r*math.cos(angle)
    x += r*math.sin(angle)
    angle -= c*math.pi/180


print(int(-x))
print(int(y))

Submission status: Accepted

Solution code:
import sys,math
x=y=r=0
m=3.14/180
for l in sys.stdin:
	h,w=map(int,l.split(","))
	x+=h*math.sin(r*m)
	y+=h*math.cos(r*m)
	r+=w
print"%d\n%d"%(x,y)

Submission status: Accepted

Solution code:
from decimal import Decimal
import math

def walk(x, y, distance, angle, next_angle):
    radian = math.radians(angle)
    _x = Decimal(distance * math.cos(radian) + x)
    x = round(_x, 6)
    _y = Decimal(distance * math.sin(radian) + y)
    y = round(_y, 6)
    angle = angle - next_angle
    return x, y, angle
    
x = 0
y = 0
angle = 90
while True:
    input_line = raw_input()
    distance = int(input_line.split(',')[0])
    next_angle = int(input_line.split(',')[1])
    if distance == 0 and next_angle == 0: break
    x, y, angle = walk(x, y, distance, angle, next_angle)
print int(x)
print int(y)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

gx = 0
gy = 0
th = 90

for s in sys.stdin:
    x, rot = map(int, s.split(','))
    gx += x * math.cos(th/180*math.pi)
    gy += x * math.sin(th/180*math.pi)
    th -= rot

print(int(gx))
print(int(gy))

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def main():
    import math
    LIST=[0,0,math.radians(90)]
    while True:
        a,b=map(float,input().split(","))
        if a==0 and b==0:
            break
        else:
            b=math.radians(b)
            LIST[0]+=a*math.sin(LIST[2])
            LIST[1]+=a*math.cos(LIST[2])
            LIST[2]-=b

    print(int(LIST[1]))
    print(int(LIST[0]))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
x,y,r = 0,0,90
while True:
  m,n = map(int,input().split(','))
  if (m,n) == (0,0):
    break
  y += m * math.sin(math.radians(r))
  x += m * math.cos(math.radians(r))
  r -= n
print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
x = 0
y = 0
an = 0
from math import *
PI = 3.1415926535898
while True:
	try:
		st, ag = map(float, raw_input().strip().split(','))
		if st == 0 and ag == 0:
			print int(x)
			print int(y)
		else:
			x += st*sin(an*PI/180)
			y += st*cos(an*PI/180)
			an += ag
	except EOFError:
		break

Submission status: Accepted

Solution code:
# 0016
import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
import math

x, y, r = 0, 0, 90
while True:
    d, t = map(float, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(math.radians(r))
    y += d * math.sin(math.radians(r))
    r -= t
print(int(x))
print(int(y))

Submission status: Accepted

Solution code:
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))))

Submission status: Accepted

Solution code:
#!/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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# -*- 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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))