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++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < ((k)+(n)); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 
template <class _Tv> inline string join(const _Tv &v,string sep=" "){
    ostringstream s;FOREACH(it,v){if(it!=v.begin())s<<sep;s<<*it;};return s.str();
}

typedef long long ll;
typedef unsigned long long ull;
typedef double D;
typedef complex<D> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define X real()
#define Y imag()
#define EPS (1e-9)
#define DEQ(p1,p2) (abs((p1)-(p2)) < EPS)

#ifdef _DEBUG
template<class _Tv> inline void _prfe(const char *_n,const _Tv _c,bool _p=false){
    ITER(_c) _it=_c.begin();
    if(_p){cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
ostream &operator<<(ostream &os, const pair<int,int> &p){return(os<<"("<<p.first<<","<<p.second<<")");}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

// 余弦定理
D cosine_theorem(D length_a, D length_b, D degree_c){
    return sqrt( length_a * length_a + length_b * length_b
        -2 * length_a * length_b * cos(degree_c / 180.0 * M_PI) );
}

int main(){
    int n;
    while(cin >> n && n){
        D s1 = 0, s2 = 0;
        int th, th2;
        th2 = 0;
        REP(i,n-1){
            cin >> th;
            s1 += cosine_theorem(1.0,1.0,th);
            th2 += th;
        }
        s1 += cosine_theorem(1.0,1.0,360-th2);
        cin >> n;
        th2 = 0;
        REP(i,n-1){
            cin >> th;
            s2 += cosine_theorem(1.0,1.0,th);
            th2 += th;
        }
        s2 += cosine_theorem(1.0,1.0,360-th2);
        if(DEQ(s1,s2)){
            cout << 0 << endl;
        } else if(s1 > s2){
            cout << 1 << endl;
        } else {
            cout << 2 << endl;
        }
    }
    return 0;
}

C++: #include<cmath>
#include<iostream>
using namespace std;
int n,m;
int N,M;
double Sn[500],Sm[500],sumN,sumM,sum;
double pi = acos(-1.0);

double d2r(int d){
  return 2.0*pi*((double)d/360.0);
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    sumM=sumN=0.0;
    for(int i=0;i<n-1;i++){
      cin>>N;
      sumN += 1.0 * 1.0 * sin( d2r(N)  ) * 0.5;
    }
    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>M;
      sumM += 1.0 * 1.0 * sin( d2r(M)  ) * 0.5;
    }
    sum=sumM-sumN;
    if(sum<0.0)sum*=-1.0;
    if(sum<0.0000001){
      cout<<0<<endl;
    }else if(sumM<sumN){
      cout<<1<<endl;
    }else{
      cout<<2<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
static const double eps = 1e-7;

void solve()
{
	int m;
	while(cin >> m)
	{
		double s1 = 0.0;
		for(int i = 0; i < m - 1; ++i)
		{
			int v;
			cin >> v;
			s1 += 0.5 * sin(M_PI * v / 180);
		}
		
		int n;
		cin >> n;
		double s2 = 0.0;
		for(int i = 0; i < n - 1; ++i)
		{
			int v;
			cin >> v;
			s2 += 0.5 * sin(M_PI * v / 180);
		}
		if(fabs(s1 - s2) < eps)
		{
			cout << 0 << endl;
		}
		else if(s1 > s2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 2 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <math.h>

using namespace std;

const double PI = 3.14159265;

int n;
int angle[360];

int main(int argc, char** argv)
{
	double osum;
	while(cin >> n, n)
	{
		int last =360;
		for(int i=0; i<n-1; i++)
		{
			cin >> angle[i];
			last -= angle[i];
		}
		angle[n-1] = last;
		
		double sum = 0.0;
		for(int i=0; i<n; i++)
		{
			sum += sin(2.0 * angle[i] * PI / 360.0) / 2.0;
		}
		
		if(osum != 0.0)
		{
			if(osum > sum) cout << 1 << endl;
			else if(osum < sum) cout << 2 << endl;
			else cout << 0 << endl;
			osum = 0.0;
		}
		else
		{
			osum = sum;
		}
	}
}

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

int main(){
  int num;
  const double PI=3.14159265;
  while(cin>>num){
    if(num==0) break;
    double area1=0.0,area2=0.0;
    int degree1=360,degree2=360;
    for(int i=0;i<num-1;i++){
      int d;
      cin>>d;
      area1+=1.0/2*sin(PI/180*d);
      degree1 -=d;
    }
    area1 += 1.0/2*sin(PI/180*degree1);

    cin>>num;
    for(int i=0;i<num-1;i++){
      int d;
      cin>>d;
      area2+=1.0/2*sin(PI/180*d);
      degree2 -=d;
    }
    area2 += 1.0/2*sin(PI/180*degree2);
    if(area1 > area2) cout<<1<<endl;
    else if(area1 < area2) cout<<2<<endl;
    else cout<<0<<endl;
  }
  return 0;
}