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

Runtime error c++ can't find solution
Posted by Ionut Marian 8 Sep 2022 12:29
#include <iostream>
using namespace std;

int main() {
    int leavingCars, minutes;
    int carPerMinute[100];
    int totalCars = 0;

    cin >> leavingCars >> minutes;
    int carsLeavingPerMinute = leavingCars * minutes;

    for(int index = 1; index <= minutes; ++index) {
        cin >> carPerMinute[index];
        totalCars += carPerMinute[index];
    }

    cout << totalCars - carsLeavingPerMinute;

    return 0;
}