|
|
back to boardWA #6 Posted by Max 7 Nov 2013 04:04 #include <iostream> using namespace std; int step(long int mas[],int n) { int i; int sum=0; for(i=n;i<n+3;i++) sum=sum+mas[i]; return sum; } int main() { int n,i; long int res; long int mas[1000]; cin >> n; for(i=0;i<1001;i++) mas[i]=0; for(i=0;i<n;i++) cin >> mas[i]; int sum=step(mas,0); res=0; for(i=0;i<n-2;i++) if(step(mas,i)<step(mas,i+1)) { sum=step(mas,i+1); res=i+3; } cout << sum << " " << res; return 0; } |
|
|