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 1787. Turn for MEGA

Работающая версия [Worked]
Posted by sovaz1997 27 Feb 2016 22:49
#include <iostream>

using namespace std;

int main() {
    int mashines, minutes;
    cin >> mashines >> minutes;

    int arr[minutes];

    for(int i = 0; i < minutes; ++i) {cin >> arr[i];}

    int m = 0;
    for(int i = 0; i < minutes; ++i) {
        m += arr[i];

        if(m - mashines >= 0) {m -= mashines;}
        else {m = 0;}
    }

    cout << m;
}
Re: Работающая версия [Worked]
Posted by Gevorg 28 Apr 2016 09:24
а тебе разрешили инициализировать массив с НЕ const параметром?

Edited by author 28.04.2016 09:29