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

AC (cpp)
Posted by lhyx1990 20 Jan 2014 22:40
//
//  main.cpp
//  p1787
//
//  Created by Huan Lin on 21/1/14.
//  Copyright (c) 2014 Huan Lin. All rights reserved.
//

#include <iostream>
#include <stdio.h>

using namespace std;

int main(int argc, const char * argv[])
{

    int k,n;
    cin >> k >> n;



    int jam = 0;

    for (int i = 0; i < n; i++) {
        int num;
        cin >> num;

        jam = jam + num - k;
        if (jam < 0) jam = 0;

    }

    cout << jam;
}
Re: AC (cpp)
Posted by Levon Oganesyan [RAU] 20 Jan 2014 23:51
remove it!