Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		m, _ := strconv.Atoi(scanner.Text())
		if m == 0 {
			break
		}
		args1 := make([]float64, m)
		x := 0.0
		for i := 0; i < m-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			x += tmp
			args1[i] = tmp
		}
		args1[m-1] = 360-x
		first_object := 0.0
		for _, v := range args1 {
			first_object+= math.Sin(v*math.Pi/180)
		}
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		args2 := make([]float64, n)
		y := 0.0
		for i := 0; i < n-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			y += tmp
			args2[i] = tmp
		}
		args2[n-1] = 360-y
		second_object := 0.0
		for _, v := range args2 {
			second_object+= math.Sin(v*math.Pi/180)
		}
		if first_object > second_object+ 0.0000001 {
			fmt.Println(1)
		} else if second_object > first_object +0.0000001 {
			fmt.Println(2)
		} else {
			fmt.Println(0)
		}
	}
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI 3.141592653589793238462643383279
#define EPS 10e-8

using namespace std;

int main()
{
	int m, n;

	int sum;
	vector <double> sa, sb;
	for (;; ){
		cin >> m;
		if (!m )
			break; 
		vector <int> a (m, 0 );
		sum = 0;
		rep (i, m - 1 ){
			cin >> a[i];
			sum += a[i];
		} // end rep
		a[m-1] = 360 - sum;
		cin >> n;
		vector <int> b (n, 0 );
		sum = 0;
		rep (j, n-1 ){
			cin >> b[j];
			sum += b[j];
		} // end rep
		b[n-1] = 360 - sum;

		double s = 0.0, t = 0.0;
		rep (i, m )
			s += sin ((double)a[i]*PI/180. );
		sa.push_back (s );
		rep (j, n )
			t += sin ((double)b[j]*PI/180. );
		sb.push_back (t );

	} // end while

	int size = sa.size();
	rep (i, size ){
		sa[i] = fabs (sa[i] ); sb[i] = fabs (sb[i] );
		if (sa[i] > sb[i]+EPS ){
			cout << '1' << endl;
		}else if (sa[i]+EPS < sb[i] ){
			cout << '2' << endl;
		}else{
			cout << '0' << endl;
		} // end if 
	} // end for

	return 0;
}

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

const double EPS=1e-10;
const double INF=1e10;

// 点オブジェクト
// ベクトルを表すのにも使う
struct Point {
    double x, y;
    Point(double x=0, double y=0) : x(x), y(y) {}
    double distance (const Point &o) const {
        return sqrt((x - o.x) * (x - o.x) + (y - o.y) * (y - o.y));
    }

    Point operator+(const Point &o) const {
        return Point(x+o.x, y+o.y);
    }

    Point operator-(const Point &o) const {
        return Point(x-o.x, y-o.y);
    }

    Point operator*(const double m) const {
        return Point(x*m, y*m);
    }

    Point operator/(const double d) const {
        return Point(x/d, y/d);
    }

    // 外積
    double cross(const Point &o) const {
        return x * o.y - y * o.x;
    }

    // 内積
    double dot(const Point &o) const {
        return x * o.x + y * o.y;
    }

    // ベクトルがx軸となす角
    double atan() const {
        return atan2(y, x);
    }

    // ベクトルの長さの二乗
    double norm() const {
        return dot(*this);
    }
};

// 点の進行方向
// 戻り値:
//     +1: 反時計回り
//     -1: 時計回り
//     +2: c, a, bの順に一直線上
//     -2: a, b, cの順に一直線上
//      0: a, c, bの順に一直線上
int ccw(Point a, Point b, Point c) {
    b = b-a, c = c-a;
    if (b.cross(c) > EPS) return +1; 
    if (b.cross(c) < -EPS) return -1;
    if (b.dot(c) < 0) return +2;
    if (b.norm() < c.norm()) return -2;
    return 0;
}

// 多角形
struct Polygon {
    vector<Point> vertex;

    Polygon() {}
    Polygon(vector<Point> vertex) : vertex(vertex) {}

    inline void add_vertex(Point v) {
        vertex.push_back(v);
    }

    void debug() {
        cout << vertex.size() << ' ';
    }

    Point next(int v) const {
        return vertex[(v+1) % vertex.size()];
    }
    Point prev(int v) const {
        return vertex[(v-1+vertex.size()) % vertex.size()];
    }

    double area() const {
        double ret = 0;
        for (int i = 0; i < vertex.size(); i++) {
            ret += vertex[i].cross(next(i));
        }
        return abs(ret) * 0.5;
    }
};

inline double deg2rad(double theta) {
    return theta / 180.0 * M_PI;
}

int main() {
    int m, n;
    while (cin >> m, m != 0) {
        vector<Point> v1, v2;
        int theta = 0;
        for (int i = 0; i < m-1; i++) {
            int dtheta;
            cin >> dtheta;
            theta += dtheta;
            v1.push_back(Point(cos(deg2rad(theta)), sin(deg2rad(theta))));
        }
        theta = 0;
        cin >> n;
        for (int i = 0; i < n-1; i++) {
            int dtheta;
            cin >> dtheta;
            theta += dtheta;
            v2.push_back(Point(cos(deg2rad(theta)), sin(deg2rad(theta))));
        }
        Polygon p1(v1), p2(v2);
        p1.add_vertex(Point(1, 0));
        p2.add_vertex(Point(1, 0));
        double a1 = p1.area();
        double a2 = p2.area();
        if (abs(a1 - a2) < EPS) {
            cout << 0 << endl;
        } else if (a1 > a2) {
            cout << 1 << endl;
        } else {
            cout << 2 << endl;
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define EPS 1e-8
double Deg_to_Rad(double a){
  return a * M_PI / 180.0;
}

int main(){
  int m, n;
  while(cin >> m, m){
    double a = 0, b = 0;

    //半径を1として考える
    //辺が長い方がBIGでは
    int sum = 360;
    for(int i = 0; i < m - 1; i++){
      int v;
      cin >> v;
      sum -= v;
      a += sin(Deg_to_Rad(v));
    }
    a += sin(Deg_to_Rad(sum));

    cin >> n;
    sum = 360;
    for(int i = 0; i < n - 1; i++){
      int v;
      cin >> v;
      sum -= v;
      b += sin(Deg_to_Rad(v));
    }
    b += sin(Deg_to_Rad(sum));
    if(fabs(a-b) < EPS) cout << 0 << endl;
    else if(a > b) cout << 1 << endl;
    else cout << 2 << endl;
  }
}

C++: //02
#include<iostream>
#include<cmath>

using namespace std;

int main(){
  for(int m;cin>>m,m;){
    int mr=360;
    double ms=0;
    for(int i=0;i<m-1;i++){
      int a;
      cin>>a;
      mr-=a;
      ms+=sin(acos(-1)*a/180);
    }
    ms+=sin(acos(-1)*mr/180);
    int nr=360;
    double ns=0;
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
      int a;
      cin>>a;
      nr-=a;
      ns+=sin(acos(-1)*a/180);
    }
    ns+=sin(acos(-1)*nr/180);
    int ans;
    if(ms>ns){
      ans=1;
    }else if(ms<ns){
      ans=2;
    }else{
      ans=0;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;


int main(void){
  int n,m;
  double v;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0;
    while(--n){
      cin >> v;
      sum1+=v;
      s1+=sin(v*M_PI/180);
    }
    s1+=sin((360-sum1)*M_PI/180);
    cin >> m;
    while(--m){
      cin >> v;
      sum2+=v;
      s2+=sin(v*M_PI/180);
    }
    s2+=sin((360-sum2)*M_PI/180);
    int res= (s1==s2)?0:(s1>s2)?1:2;
    cout << res << endl;
  }

  return 0;
}