Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]float64, 10)
	for scanner.Scan() {
		info := strings.Split(scanner.Text(), ",")
		for j := 0; j < 10; j++ {
			a[j], _ = strconv.ParseFloat(info[j], 64)
		}
		v1, _ := strconv.ParseFloat(info[10], 64)
		v2, _ := strconv.ParseFloat(info[11], 64)
		sum := 0.0
		for i := 0; i < 10; i++ {
			sum += a[i]
		}
		match := v1 * ((sum/(v1+v2)))
		if match == 0 {
			fmt.Println(1)
		} else {
			sum = 0
			for k := 0; k < 10; k++ {
				sum += a[k]
				if match <= sum {
					fmt.Println(k+1)
					break
				}
			}
		}
	}
}

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

int main()
{
	int l[10], v1, v2, n, cnt;
	double d, t;
	char ch;
	while (cin>>l[0]>>ch){
		n = l[0];
		for (int i = 1; i < 10; i++)
		{
		    cin >> l[i] >> ch;
		    n += l[i];
		}
		cin >> v1 >> ch >> v2;
		t=n/(v1+v2);
		d=v1*t;    //列車1の動く距離
		cnt=0;
		while(d>0){
		d -= l[cnt];
		cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rep(i,n) for(int i=0;i<n;i++)

int main(int argc, char **argv)
{
  vi l(10,0), v(2,0);
  char c;
  int total;
  for (;;) {
    rep (i, 10) {
      cin >> l[i];
      cin >> c;
    }
    cin >> v[0] >> c >> v[1];
    if (cin.eof())
      break;

    total = 0;
    tr (l, i) {
      *i = *i * (v[0]+v[1]);
      total += *i;
    }
    int time = total / (v[0]+v[1]);
    int i = 0;
    int d = 0;
    for (; d < time*v[0]; d += l[i++])
      ;
    cout << i << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
double d[15];
int main() {
	double l[15],v[5];
	char c[15];
	double x=0.0,y;
	int ans;
	while(true){
		cin>>l[0]>>c[0]>>l[1]>>c[1]>>l[2]>>c[2]>>l[3];
		cin>>c[3]>>l[4]>>c[4]>>l[5]>>c[5]>>l[6]>>c[6];
		cin>>l[7]>>c[7]>>l[8]>>c[8]>>l[9]>>c[9]>>v[0];
		cin>>c[10]>>v[1];
		if (cin.eof())break;
		for(int i=0;i<=9;i++){
			x+=l[i];
		}
		double t;
		t=x/(v[0]+v[1]);
		y=v[0]*t;
		for(int i=1;i<=10;i++){
			for(int j=0;j<i;j++){
				d[i]+=l[j];
			}
		}
		for(int i=1;i<=10;i++){
			if(y<=d[i]){
				ans=i;
				break;
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define INF (2 << 28)
#define fr first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<int, int> iP;

typedef pair<double, double> dP;

int main(){
  
  string line;
  int l[10];
  
  while(~scanf("%d,", l)){
    int v1, v2;
    vector <dP> t1(10);
    vector <dP> t2(10);
    int l1[10] = {}, l2[10] = {};
    
    for(int i = 1; i < 10; i++) 
      scanf("%d,", l + i);
    scanf("%d,%d", &v1, &v2);
    
    l1[0] = l[0], l2[9] = l[9];
    for(int i = 1; i < 10; i++){
      l1[i] += l1[i - 1] + l[i];
      l2[9 - i] += l2[9 - i + 1] + l[9 - i];
    }
     
    double begin = 0;
    for(int i = 0; i < 10; i++){
      t1[i].fr = begin;
      t1[i].sc = (double)l1[i] / v1;
      begin = (double)l1[i] / v1;
    }

    begin = 0;
    for(int i = 9; i >= 0; i--){
      t2[i].fr = begin;
      t2[i].sc = (double)l2[i] / v2;
      begin = (double)l2[i] / v2;
    }

    for(int i = 0; i < 10; i++){
      if(!(t1[i].fr > t2[i].sc || t2[i].fr > t1[i].sc)){
        cout << i + 1 << endl;
        break;
      }
    }
  }
}

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

int main() {
	int l[10];
	int v1, v2;
	char d;
	while (cin >> l[0] >> d >> l[1] >> d >> l[2] >> d >> l[3] >> d >> l[4] >> d >> l[5] >> d >> l[6] >> d >> l[7] >> d >> l[8] >> d >> l[9] >> d >> v1 >> d >> v2) {
		double sum = 0;
		for (int i = 0; i < 10; ++i) {
			sum += l[i];
		}
		double p1 = v1 * sum / (v1 + v2);
		for (int i = 0; i < 10; ++i) {
			p1 -= l[i];
			if (p1 <= 0) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}

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

int main()
{
    int l[10] , v1 , v2 , n , m;
    double d , t;
    char ch;
    while(cin>>l[0]>>ch>>l[1]>>ch>>l[2]>>ch>>l[3]>>ch>>l[4]>>ch>>l[5]>>ch>>l[6]>>ch>>l[7]>>ch>>l[8]>>ch>>l[9]>>ch>>v1>>ch>>v2>>ch){
        t=n/(v1+v2);
        d=v1*t;    //列車1の動く距離
        m=0;
        for(int i=0;i<10;i++){
            m+=l[i];
            if(m<d){
                cout << i << endl;
                break;
            }
        }
    }
	return 0;
}

C++: #include <cstdio>
using namespace std;

int l[10], v[2], sum;

int main(){
	while (true) {
		sum = 0;
		for (int i = 0; i < 10; i++) {
			if (scanf("%d,", &l[i]) == EOF) {
				return 0;
			}
			sum += l[i];
		}
		scanf("%d,%d,", &v[0], &v[1]);
		double t = 1.0 * sum / (v[0] + v[1]);
		t *= v[0];
		double loc = 0;
		for (int i = 0; i < 10; i++) {
			loc += l[i];
			if (t <= loc) {
				printf("%d\n", i+1);
				break;
			}
		}
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
typedef vector <int> VI;
typedef vector <double> VD;

int main( void )
{
	VD l(10); char c; int v1, v2;
	while ( cin.eof() == false )
	{
		for ( int i = 0; i < 10; i++ ) cin >> l[i] >> c;
		cin >> v1 >> c >> v2;

		double length = accumulate( l.begin(), l.end(), 0.0 );
		double tc = length / ( v1 + v2 );
		double now = v1 * tc;

		int answer = -1;
		double sum = 0;
		for ( int i = 0; i < l.size(); i++ )
		{
			if ( sum <= now && now <= sum + l[i] )
			{
				answer = i+1;
				break;
			}
			sum += l[i];
		}

		cout << answer << endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

double l[10],v1, v2;

int main()
{
    loop:
    while ( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2 ) != EOF )
    {
        v2 += v1;
        for( int i = 0; i < 10; i++ )
        {
            l[i] += ( ( i == 0 ) ? 0 : l[i - 1] );
        }
        double t = l[9] / v2;
        double dis = v1 * t;
        for( int i = 0; i < 10; i++ )
        {
            if( dis == l[i] )
            {
                printf( "%d\n", i + 1 );
                goto loop;
            }
            else if( dis < l[i] )
            {
                printf( "%d\n", i + 1 );
                goto loop;
            }
        }
        /* for( int i = 0; i < 10; i++ )
        {
            if( l[i] <= dis && dis <= l[i + 1] )
            {
                printf( "%d\n", i + 2 );
                return 0;
            }
        } */
    }
    return 0;
}

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

#define SIZE 10

int main() {
	int l[SIZE] = {0}, v1, v2;
	double s;
	char t;
	while (true) {
		for (int i = 0; i < SIZE; i++) {
			cin >> l[i];
			cin >> t;

			if (i == 0) continue;
			l[i] += l[i - 1];
		}
		cin >> v1 >> t >> v2;
		s = (double)l[SIZE - 1] / (v1 + v2);

		for (int i = 0; i < SIZE; i++) {
			if (l[i] >= s * v1) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}