ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1910. Titan Ruins: Hidden Entrance

WA #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;
}