|
|
back to boardAC (cpp) // // 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; } |
|
|