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 <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);
    }

    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) {
        if (m == 0) break;
        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))));
        }
        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))));
        }
        double a1 = Polygon(v1).area();
        double a2 = Polygon(v2).area();
        if (abs(a1 - a2) < EPS) {
            cout << 0 << endl;
        } else if (a1 > a2) {
            cout << 1 << endl;
        } else {
            cout << 2 << endl;
        }
    }
    return 0;
}

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

int main(){
  int m,n,v;
  double s1,s2;

  while(1){
    cin >> m;
    if(!m)break;

    s1 = 0.0;
    for(int i=1;i<m;i++){
      cin >> v;
      s1 += sin(M_PI*v/180)/2.0;
    }

    cin >> n;
    s2 = 0.0;
    for(int i=1;i<n;i++){
      cin >> v;
      s2 += sin(M_PI*v/180)/2.0;
    }

    if(s1>s2)cout << 1 << endl;
    else if(s1<s2)cout << 2 << endl;
    else cout << 0 << endl;
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

double conv(double dosu) {
  return dosu*M_PI/180.0;
}

int main() {
  int M;
  
  while(cin >> M && M) {
    int sum = 0;
    double S = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      S += sin(conv(arg));
      sum += arg;
    }
    
    S += sin(conv(360-sum));
    cin >> M;
    sum = 0;
    double T = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      T += sin(conv(arg));
      sum += arg;
    }
    
    T += sin(conv(360-sum));
    
    if(S == T) cout << 0 << endl;
    else if(S < T) cout << 2 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second

int dx[]={0,1,0,-1},dy[]={1,0,-1,0};


main(){
  int m;
  while(cin>>m,m){
    int v=0;
    double s1=0;
    rep(i,m-1){
      int tv;
      cin>>tv;
      v+=tv;
      s1+=sin(M_PI/180*tv);
    }
    s1+=sin(M_PI/180*(360-v));
    v=0;
    cin>>m;
    rep(i,m-1){
      int tv;
      cin>>tv;
      v+=tv;
      s1-=sin(M_PI/180*tv);
    }
    s1-=sin(M_PI/180*(360-v));
    if(abs(s1)<EPS)cout<<0<<endl;
    else if(s1<0)cout<<2<<endl;
    else cout<<1<<endl;
  }
}

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

using namespace std;

double calc(int x) {
  return sin((double)x*M_PI/180);
}
 

int main(void){
  int n,m;
  
  while(cin >> n,n){
    int sum1=0,sum2=0;
    double s1=0,s2=0;
   
    for(int i=0;i<n-1;i++){
      int v;
      cin >> v;
      sum1+=v;
      s1+=calc(v);
    }
    s1+=calc(360-sum1);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=calc(v);
    }
    s2+=calc(360-sum2);
    if(s1>s2) cout << 1 << endl;
    else if(s1<s2) cout << 2 << endl;
    else cout << 0 << endl;
  }

  return 0;
}