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<vector>

int main(){
	int first;
	while(std::cin>>first){
		std::vector<int> distance(10);
		distance[0]=first;
		int a=0;
		int sum=0;
		char dummy;
		sum+=first;
		for(int i=1;i<10;++i){
			std::cin>>dummy;
			int s;
			std::cin>>s;
			sum+=s;
			a+=s;
			distance[i]=a;
		}
		double v1,v2;
		std::cin>>dummy>>v1>>dummy>>v2;
		int ans=0;
		for(int i=0;i<10;++i){
			if(distance[i]<=sum/(v1+v2)*v1){
				ans=i+1;
			}
		}
		std::cout<<ans<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>
const double EPS = 1e-12;
const int N = 10;
#define EQ(a,b) (abs((a)-(b)) < EPS)

int v[N], a, b;

int solve(){
  double d = 0, sum = 0;
  REP(i, N) sum += v[i];
  if(a >= b){
    REP(i, N - 1){
      double st = d / a, et = (d + v[i]) / a, sb = min(sum - b * et, sum - b * st), eb = max(sum - b * et, sum - b * st);
      //cout <<i + 1 <<" | " <<st <<", " <<et <<" | " <<d <<", " <<d + v[i] <<", " <<sb <<", " <<eb <<endl;
      if((eb >= d && eb <= d + v[i]) || (sb >= d && sb <= d + v[i])) return i + 1;
      d += v[i];
    }
    return 10;
  } else{
    for(int i = 9; i > 0; --i){
      double st = d / b, et = (d + v[i]) / b, sb = min(sum - a * et, sum - a * st), eb = max(sum - a * et, sum - a * st);
      //cout <<i + 1 <<" | " <<st <<", " <<et <<" | " <<d <<", " <<d + v[i] <<", " <<sb <<", " <<eb <<endl;
      if(EQ(d + v[1], sb)) return i;
      if((eb >= d && eb <= d + v[i]) || (sb >= d && sb <= d + v[i])) return i + 1;
      d += v[i];
    }
    return 1;
  }
}

int main() {
  while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9], &a, &b) != EOF) cout <<solve() <<endl;
  return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	int n,l[MAX], v1, v2, sum = 0, sum2 = 0;
	double x1, x2;
	char ans;	  // 1, 2, 3, 4, 5, 6, 7, 8, 9,10,v1,v2
	while (scanf_s("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) != EOF) {
		for (int i = 0; i < MAX; ++i) {
			sum += l[i];
		}
		x1 = (double)sum / (v1 + v2) * v1;
		x2 = (double)sum / (v1 + v2) * v2;
		for (int i = 0; i < MAX; ++i) {
			sum2 += l[i];
			if (sum2 >= x1 || sum - sum2 <= x2) {
				printf("%d\n", i + 1);
				break;
			}
		}
		sum = sum2 = 0;
	}

}

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

int main(){
	int ary[20]={};
	int spd[2]={};
	while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&ary[1],&ary[2],&ary[3],&ary[4],&ary[5],&ary[6],&ary[7],&ary[8],&ary[9],&ary[10],&spd[0],&spd[1])!=EOF){
		for(int i=2;i<=10;i++){
			ary[i]+=ary[i-1];
		}

		double piy=(double)(ary[10]*spd[0])/(double)(spd[0]+spd[1]);
		int hog=ceil(piy);
		int res;
		for(int i=0;i<=10;i++){
			if(hog<=ary[i]){
				res=i;
				break;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

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

int main()
{
	int len[10];
	int v1,v2;
	while( scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &len[0],&len[1],&len[2],&len[3],&len[4],&len[5],&len[6],&len[7],&len[8],&len[9],&v1,&v2) != EOF ){
		int accum[10] = {0};
		accum[0] = len[0];
		for(int i=1;i<10;i++){
			accum[i] += accum[i-1] + len[i];
		}
		
		// accum[9] は合計の距離
		double t = (double)accum[9]/(v1 + v2);
		double dist = (double) v1*t;
		for(int i=0;i<10;i++){
			if( dist < accum[i] ){
				cout<<i<<endl;
				break;
			}
		}
	}
	return 0;
}

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

int main()  {

    double lines[10], t, v1, v2, maxv, sumv, rv1;
    int idx = -1;
    while (scanf("%lf", &lines[0]) != EOF) {
        for (int i = 1; i < 10; i++) {
            scanf(",%lf", &t);
            lines[i] = lines[i-1]+t;
        }
        scanf(",%lf,%lf", &v1, &v2);
        maxv = max(v1, v2);
        sumv = v1+v2;
        while (lines[9] < maxv) {
            for (int i = 0; i < 10; i++) lines[i] *= 10;
        }
        rv1 = lines[9]*v1/sumv;
        for (int i = 0; i < 10; i++) if (lines[i] >= rv1) { idx = i+1; break; }
        printf("%d\n", idx);


    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define MAX 10
#define EPS 0.000000001

main(){
  double len, v1, v2, A[MAX+1], l;
  char ch;
  while( cin >> l ){
    for ( int i = 0; i <= MAX; i++ ) A[i] = 0;
    A[0] = 0;
    A[1] = l;
    for ( int i = 2; i <= MAX; i++ ) {
      cin >> ch >> l;
      A[i] = A[i-1] + l;
    }
    cin >> ch >> v1 >> ch >> v2;
    double p = 1.0*A[MAX]*v1/(v1+v2);
    int cur = 0;
    for ( ; ;cur++ ){
      if (  p < A[cur] || fabs(p - A[cur]) < EPS) {
	cout << cur << endl;
	break;
      }
    }
  }
}

C++: #include<iostream>

#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(void){
	int l[10];
	int v[2];
	char tmp;
	double x;
	int cnt=0;
	while(cin>>l[0]){
		cin>>tmp;
		loop(i,1,10)cin>>l[i]>>tmp;
		cin>>v[0]>>tmp>>v[1];
		
		int sum = 0;
		rep(i,10)sum+=l[i];
		
		x = sum * v[0]/(v[0] + v[1]);
		
		sum = 0;
		rep(i,10){
			sum+=l[i];
			cnt++;
			if(sum>=x){
				cout<<cnt<<endl;
				break;
			}		
		}
	}

}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int l[10];
    int v1, v2;
    int passby; //上り電車が進んだ距離
    int num; //すれ違った区間の番号
    int length; //線路の長さ
    
    while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) != EOF){
        for(int i = 0; i < 10; i++){
            length += l[i];
        }
        passby = length * v1 / (v1 + v2); //この式は上り電車と下り電車の移動時間が等しいという式の形を変えたもの
        
        int sum = 0; //sum:すれ違った区間の番号を調べるのに必要
        for(int i = 0; i < 10; i++){
            sum += l[i];
            if(passby == l[i]) num = l[i];
        }
        cout << num << endl;
    }
}