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

test #5
Posted by Sperow 14 Oct 2020 01:59
I can't find a problem
Please, help


my code (C++):


#include <iostream>
#include <string>
using namespace std;
int main()
{
    int a, b, c, sum, sr, i, n;
    cin >> n;
    cin >> a >> b >> c;
    sum = 0;
    if (n == 3) {
        sum = a + b + c;
        sr = 2;
    }
    else {
        for (i = 3; i < n; i++) {
            if ((a + b + c) > sum) {
                sum = a + b + c;
                sr = i - 1;

            }
            a = b;
            b = c;
            cin >> c;

        }
    }
    cout << sum<< " "<<sr;

    return 0;
}