|
|
back to boardHelp, WA#6 #include <iostream> using namespace std; int main() { int n, i, j; cin >> n; long *a = new long[n]; long *b = new long[n]; long *c = new long[n]; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i <= n - 3; i++){ b[i] = a[i] + a[i + 1] + a[i + 2]; c[i] = i + 2; } for (j = 0; j <= n; j++) for (i = j+1; i <= n; i++) if (b[i] == b[j]){ c[i] = c[j]; } long max = b[0]; long imax = c[0]; for (i = 0; i <= n - 4; i++) if (b[i] < b[i + 1]){ max = b[i + 1]; imax = c[i + 1]; } cout << max << ' ' << imax << endl; } Edited by author 20.10.2013 00:12 Edited by author 20.10.2013 00:12 |
|
|