|
|
back to boardWA2? Posted by Николай 23 Sep 2013 20:22 #include<iostream> using namespace std; int main() { int a; cin >> a; if(a > 100 || a < 1) exit(0); int b[101]; int c; cin >> c; if(c > 100 || c < 1) exit(0); for(int i=0;i<c;i++) { cin >> b[i]; if(b[i] >= 101 || b[i] <= 0) exit(0); } int d=0; int j=0; int k=0; for(int i=0;i<c;i++) { if(i == c-1) k=b[i]-a; j=0; if(b[i] > a) { j=b[i]-a; b[i+1]+=j; d+=a; } } cout << k; system("pause"); return 0; } |
|
|