Cod sursa(job #2919364)
Utilizator | Data | 16 august 2022 23:37:17 | |
---|---|---|---|
Problema | A+B | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#define int long long
using namespace std;
const int MAX_N = 1e5;
int a[MAX_N + 1];
int n;
signed main() {
cin >> n;
int s = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
s += a[i];
}
for (int i = 1; i <= n; i++) {
if ((s - a[i]) + -a[i] == 0) {
cout << i;
return 0;
}
}
cout << "-1";
return 0;
}