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 <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	double L;
	vector<double> v(10);
	char ch;

	int v1, v2;
	while (cin >> L) {
		v.at(0) = L;
		double sum = 0;
		sum += L;

		for (int i = 1; i < 10; i++) {
			cin >> ch >> v.at(i);
			sum += v.at(i);
		}
		cin >> ch >> v1 >> ch >> v2;
		/*for (int i = 0; i < 10; i++) {
			cout << v.at(i);
		}
		cout << v1 << ',' << v2 << endl;*/
		//cout << sum << endl;

		double hs = sum / (v1 + v2);
		double dis = v1 * hs;
		//cout << fixed << setprecision(5) << "hs:" << hs << endl;
		//cout << fixed << setprecision(5) << "dis:" << dis << endl;

		double sd = 0;
		for (int i = 0; i < 10; i++) {
			sd += v.at(i);
			if (dis <= sd) {
				cout << i+1 << endl;
				break;
			}
		}
	}
}

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

int main() {
	int l[10],v1,v2;
	int len;
	float len1,len2;
	
	
	while(len=0,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)+1){
		for(int i=0;i<10;++i)len+=l[i];
		
		len1=0;
		len2=len;
		
		while(fabs(len1 - len2) > 1.0 ){
			len1 += 0.01f * v1;
			len2 -= 0.01f * v2;
		}
		
		len2=0;
		for(int i=0;i<9;++i){
			if(len1 >= len2 && len1 <len2+l[i]){
				cout<<i+1<<endl;
				break;
			}
			len2+=l[i];
		}
		
	}
	
	return 0;
}

C++: #include<iostream>
#include<array>
#include<numeric>

using namespace std;

// 二つの列車がすれ違う時刻
// v1 * t = 全長 - v2 * t
// (v1 + v2) * t = 全長
// t = 全長/ (v1 + v2)

// 二つの列車がすれ違う場所
// x = v1 * t

int main() {

	while (true) {
		array<int, 10> l;
		int v1, v2;
		for (int& a : l) {
			cin >> a;
			cin.ignore();
		}
		cin >> v1;
		cin.ignore();
		cin >> v2;
		if (cin.eof()) {
			break;
		}
		double t = static_cast<double>(accumulate(l.begin(), l.end(), 0)) / (v1 + v2);
		double x = v1 * t;
		
		// 誤差により全長をオーバーする場合を考えて10に初期化
		int result = 10;
		int sum = 0;
		for (int i = 0; i < 10; ++i) {
			sum += l[i];
			if (x <= sum) {
				result = i + 1;
				break;
			}
		}
		cout << result << endl;
	}
	

	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

int main() {
	int v1,v2,ret;
	double h,sum=0;
	vector<int> l(10, 0);
	while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[1],&l[2],&l[3],&l[4],&l[5],&l[6],&l[7],&l[8],&l[9],&l[10],&v1,&v2) != EOF) {
		for (int i=0; i<10; i++) {
			sum += l[i];
		}
		sum /= (v1+v2);
		sum *= v1;
		for (int i=0; i<10; i++) {
			sum -= l[i];
			if (sum < 0) {
				ret = i;
				break;
			}
		}
		cout << ret << endl;
	}
	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; double 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 <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

int main() {
	int l[10],v1,v2;
	int len;
	float len1,len2;
	
	
	while(len=0,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)+1){
		for(int i=0;i<10;++i)len+=l[i];
		
		len1=0;
		len2=len;
		
		while(fabs(len1 - len2) > 0.1 ){
			len1 += 0.001f * v1;
			len2 -= 0.001f * v2;
			if(len1>=len2)break;
		}
		
		len2=0;
		for(int i=0;i<9;++i){
			if(len1 >= len2 && len1 <len2+l[i]){
				cout<<i+1<<endl;
				break;
			}
			len2+=l[i];
		}
		
	}
	
	return 0;
}

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;
		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 <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, m, n) for(int i = m; i < n; i++)
#define MREP(i, m, n) for(int i = m - 1; i >= n; i--)
using namespace std;

class train{
	public:
		int v;
		double vRatio;
		double distance;
		int currentSta;

		train(int v = 0, double vRatio = 0.0, double distance = 0.0, int currentSta = 0):v(v), vRatio(vRatio), distance(distance), currentSta(currentSta){}
		
		void wantVRatio(int other){
			vRatio = (double)v / ((double)v + (double)other);
		}

		void wantDistance(int railsum){
			distance = (double)railsum * vRatio;
		}
	private:

	protected:

};


int main(){
	while(1){
		map<int, int> rail;
		int railsum = 0;
		train up, down(0,0.0,0.0,10);

		scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &rail[0], &rail[1], &rail[2], &rail[3], &rail[4], &rail[5], &rail[6], &rail[7], &rail[8], &rail[9], &up.v, &down.v);

		PREP(i, 0, 10){
			railsum += rail[i];
		}

		up.wantVRatio(down.v);
		down.wantVRatio(up.v);

		while(1){
			int uptmp = 0, downtmp = 0;
			up.wantDistance(railsum);
			down.wantDistance(railsum);

			PREP(i, up.currentSta, down.currentSta){
				up.distance -= rail[i];
				if(up.distance < rail[i]) {
					uptmp = i;
					break;
				}
			}

			MREP(i, down.currentSta, up.currentSta){
				down.distance -= rail[i];
				if(down.distance < rail[i]){
					downtmp = i;
					break;
				}
			}

			up.currentSta = uptmp;
			down.currentSta = downtmp;

			if((down.currentSta - up.currentSta) >= 3){
				int sum = 0;
				PREP(i, up.currentSta, down.currentSta){
					sum += rail[i];
				}
				railsum = sum;
			}
			else if((down.currentSta - up.currentSta) == 2){
				//この2の内訳は、インデックスが0~9までに対して問題の区間番号が1~10定義になっているので+1と
				//仮に各電車の区間番号が5,7だった場合、すれ違うのは6なので5+1のための+1
				cout << up.currentSta + 2 << endl;
				break;
			}
			else{
				//インデックスが0~9までに対して問題の区間番号が1~10定義になっているので+1
				cout << (up.currentSta > down.currentSta ? down.currentSta + 1 : up.currentSta + 1) << endl;
				break;
			}
		
		}
	
	}
	return 0;
}