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

Why wrong answer? Test #3.
Posted by anar 2 Jul 2013 23:34
#include <iostream>

using namespace std;

int main()
{
    int k,n,s,i,g,r;
    cin>>k;
    s=0;
    cin>>n;
    int *a=new int[n];
    for (i=0;i<n;i++){
        cin>>a[i];
        s=a[i]+s;
        };
    g=s-(n*k);
    cout<<g;
    return 0;
}
Re: Why wrong answer? Test #3.
Posted by Charles Mei 21 Jul 2013 00:29
consider this situation: when the number of the remaining cars until the current moment is less than k.
for example
5 3
3 6 5
the result is 1 not 0
Re: Why wrong answer? Test #3.
Posted by Logan`~ 14 Sep 2018 20:32
попробуйте
5 5
0 0 0 0 0