Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[200000];
- int main()
- {
- int n;
- int s = 0;
- int mx = -20000;
- int mi = -20000;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int x;
- cin >> x;
- s += x;
- a[i] = s;
- }
- for (int i = 0; i < n - 1; i++) {
- if (a[i] * (a[n - 1] - a[i]) > mx) {
- mx = a[i] * (a[n - 1] - a[i]);
- mi = i;
- }
- }
- cout << mi + 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement