-
-
Save fredbr/9a64eca693f56df1ea10d030a6f790b6 to your computer and use it in GitHub Desktop.
Guerra por Território
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//solucao por Davi Gabriel | |
#include <bits/stdc++.h> | |
using namespace std; | |
int v[100100]; | |
int main() { | |
int n, total = 0, somaI = 0; | |
cin >> n; | |
for(int i = 0; i < n; ++i){ | |
cin >> v[i]; | |
total += v[i]; | |
} | |
for(int i = 0; i < n; ++i){ | |
somaI += v[i]; | |
if(somaI == total/2){ | |
cout << i + 1 << endl; | |
return 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment