|
|
back to boardWhat problem? Test 3 #include<iostream> using namespace std; int main() { int k, n, a[1010], A, sklad; cin >> k >> n; if ((1 <= k && k <= 100) && (1 <= n && n <= 100)) { for (int b = 0; b < n; b++) { cin >> a[b]; } sklad = 0; for (int c = 0; c < n; c++) { A = k - (a[c] + sklad); if (A < 0) { sklad = -A; } else sklad = 0; } if (A < 0) { cout << -A; } else cout << A; } return 0; } Re: What problem? Test 3 Posted by Logan`~ 14 Sep 2018 20:31 попробуйте 5 5 0 0 0 0 0 |
|
|