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: Accepted

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 int(x)
print int(y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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(int(x))
print(int(y))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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(int(x))
print(int(y))
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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]
if x >= 0:
    print(floor(x))
else:
    print(floor(x)+1)
if y >= 0:
    print(floor(y))
else:
    print(floor(y)+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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))
    print(int(y))

        
        
            
TreasureHunt()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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(math.modf(x)[1]))
print('{0:.0f}'.format(math.modf(y)[1]))

Submission status: Accepted

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 * pi / 180

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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),sep='\n')

Submission status: Accepted

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))
print(int(z.imag))

Submission status: Accepted

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),'\n',int(z.imag),sep='')

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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(int(x))
print(int(y))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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.fd(x[0])
		kame.right(x[1])
		continue
print int(kame.xcor())
print int(kame.ycor())

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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))
print(int(z.imag))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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
    y +=math.cos(angle)*d
    x +=math.sin(angle)*d
    angle -=a*math.pi/180
print(int(y))
print(int(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

x = 0
y = 0
angle = math.pi / 2

while(1):
    d, a = map(int, input().split(","))
    if d == 0 and a == 0:
        break

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

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

Submission status: Accepted

Solution code:
import math

if __name__ == '__main__':
    x = 0
    y = 0
    angle = 90

    r, t = map(int, input().split(','))

    while r != 0 or t != 0:
        x = x + r * math.cos(math.radians(angle))
        y = y + r * math.sin(math.radians(angle))
        angle -= t
        r, t = map(int, input().split(','))
    print(int(x))
    print(int(y))

Submission status: Accepted

Solution code:
from math import sin,cos
x,y,t = 0,0,90
while(True):
    d,a = map(int,input().split(","))
    if d==0 and a==0:
        print(int(x))
        print(int(y))
        break
    x += d*cos(t/180*3.141592)
    y += d*sin(t/180*3.141592)
    t -= a