Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>

#define ANGLE (M_PI/180.0)
using namespace std;
int main(void) {
  int walk, dir;
  double x = 0.0, y = 0.0, angle = 0.0;
  char c;

  while(cin >> walk >> c >> dir, walk != 0 && dir != 0) {
    x += (double)walk * sin(angle * ANGLE);
    y += (double)walk * cos(angle * ANGLE);
    angle += (double)dir;
  }
  cout << (int)x << endl << (int)y << endl;
  return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
#define PI 3.14159265358979

using namespace std;

int main()
{
	string s;
	int d = 90;
	double x = 0;
	double y = 0;
	while (cin >> s){
		
		//入力
		if (s == "0,0"){
			break;
		}
		string left = "";
		string right = "";
		for (int i = 0;; i++){
			if (s[i] == ','){
				for (int j = i + 1; j < (signed)s.length(); j++){
					right += s[j];
				}
				break;
			}
			left += s[i];
		}
		int walk = stoi(left);
		int turn = stoi(right);

		//計算
		double rad = d * PI / 180.0;
		x += walk * cos(rad);
		y += walk * sin(rad);
		d = (d - turn + 360) % 360;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include <iostream>
#include <numeric>
#include <cstdlib>
using namespace std;

int main(){
	double x = 0.0;
	double y = 0.0;
	double angle = 90.0;
	for(;;){
		double hos;
		double change;
		char c;
		cin >> hos >> c >> change;
		if(hos == 0 && change == 0) break;
		x += hos * std::cos(angle * 3.14159 / 180);
		y += hos * std::sin(angle * 3.14159 / 180);
		angle -= change;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main()
{
  double x,y = 0;
  int walk;
  int rad;
  int sumrad = 90;
  while( scanf("%d,%d", &walk, &rad), walk){
    x += walk*cos((double)sumrad*3.141592/180);
    y += walk*sin((double)sumrad*3.141592/180);
    sumrad -= rad;
  }
  cout << (int)x << endl
       << (int)y << endl;

  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main(){
	double x, y;
	double angle = 90;
	int a, b;
	while(1){
		scanf("%d,%d", &a, &b);
		if(a == 0 && b == 0) break;
		double rad = angle * M_PI / 180;
		x += a * cos(rad);
		y += a * sin(rad);
		angle -= b;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

struct point {
	double x, y;
	point(double x_ = 0, double y_ = 0):x(x_), y(y_) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator*(const double d) const {
		return point(x * d, y * d);
	}
};

inline point rotate(const point &p, double theta) {
	const double s = sin(theta);
	const double c = cos(theta);
	return point(c * p.x - s * p.y, s * p.x + c * p.y);
}

inline double degree_to_radian(double degree) {
	return degree / 180.0 * M_PI;
}

int main() {
	point current(0, 0);
	point direction(0, 1);

	for(int d, t; scanf("%d,%d", &d, &t) == 2 && (d | t);) {
		current = current + direction * d;
		direction = rotate(direction, -degree_to_radian(t));
	}

	cout << (int)current.x << endl;
	cout << (int)current.y << endl;

	return EXIT_SUCCESS;
}

C++: #include<iostream>
#include<math.h>
using namespace std;

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=0;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos((rad+prad)*pi/180);
		dy=d*sin((rad+prad)*pi/180);
		x+=dx;
		y+=dy;
		prad=rad+prad;
		//cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	//while(1);
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main() {
	double sum,x,y,b,c;
	int a, d;
	a = 0;
	x = 0;
	y = 0;
	sum = 0;
	while (scanf("%d,%d",&d,&a)) {
		if (a == 0 && d == 0) break;
		b = (double)a;
		c = (double)d;
		x += c*cos(sum*3.1416/180);
		y += c*sin(sum*3.1416/180);
		sum += b;
	}
	cout << (int)y << " " << (int)x << endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define _USE_MATH_DEFFINES
#include <cmath>
using namespace std;
typedef complex<double> P;

double convert(double angle) {
    return((M_PI * (angle / 180.0)));
}

P now(0, 0);
double angle = 0;

int main(void) {
    int fd, spin;
    
    while(scanf("%d,%d", &fd, &spin), fd + spin != 0) {
        double nextx = now.real() + fd * sin(convert(angle)),
        nexty = now.imag() + fd * cos(convert(angle));
        now = P(nextx, nexty);
        angle += spin;
    }
    cout << (int)now.real() << endl << (int)now.imag() << endl;
    return(0);
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;



int main(){
	int r, ang;
	double x=0, y=0;

	while(1){

		scanf("%d,%d", &r, &ang);
		if(r==0) break;

		x += r * cos(ang*M_PI/180);
		y += r * sin(ang*M_PI/180);

	}

	cout << (int)x << endl;
	cout << (int)y << endl;

	return 0;
}

C++: //Aizu - 0016 : Treasure Hunt
#include<stdio.h>
#include<math.h>

const double PAI = acos(-1.0);
//#define PAI 3.1415926

int main()
{
	int d,t,ang=0;
	double x=0,y=0;

	while(scanf("%d%*c%d",&d,&t)&&(!(d==0&&t==0)))			//霎灘?0,0扈捺據
	{
		x+=d*sin(1.0*PAI*ang/180);						//隶。邂?		y+=d*cos(1.0*PAI*ang/180);
		ang+=t;
	}

	printf("%d\n%d\n",(int)x,(int)y);					//霎灘?

	return 0;
}

C++: ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <math.h>
&#160;
void walk(double current_point[2], int r, int sum_theta) {
&#160; &#160; double pi = 3.14159265358979;&#160;
&#160; &#160; double rad = ((double)sum_theta / 180) * pi;
&#160; &#160; current_point[0] += r * sin(rad);
&#160; &#160; current_point[1] += r * cos(rad);
}
&#160;
int main() {
&#160; &#160; int r;
&#160; &#160; int theta;
&#160; &#160; int sum_theta = 0;
&#160; &#160; double current_point[2] = {0, 0};
&#160;
&#160; &#160; do {
&#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
&#160;
&#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
&#160; &#160; &#160; &#160; sum_theta += theta;
&#160; &#160; } while(r || theta);
&#160;
&#160; &#160; printf("%d\n", (int)current_point[0]);
&#160; &#160; printf("%d\n", (int)current_point[1]);
&#160;
&#160; &#160; return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main(){
	int w,deg;
	double x=0,y=0,pre=M_PI/2;
	string buf;
	while(cin>>buf){
		/* atoi */
		int ptr=0;
		string tmp1,tmp2;
		while(buf[ptr]!=',') tmp1+=buf[ptr++];
		w = atoi(tmp1.c_str());
		++ptr;
		while(buf[ptr]) tmp2+=buf[ptr++];
		deg = atoi(tmp2.c_str());
		/* read end */
		if(w==0&&deg==0) break;
		x+=(double)w*cos(pre);
		y+=(double)w*sin(pre);
		pre-=(double)deg*M_PI/180;
	}
	cout << (int) x << endl;
	cout << (int) y << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  double a,b,x=0,y=0,s=0;
  while(scanf("%lf,%lf",&a,&b),a&&b){
    x+=(int)a*cos(s*P/180);
    y+=(int)a*sin(s*P/180);
    s+=b;
  }cout<<(int)y<<endl<<(int)x<<endl;
}