|
|
back to boardответ на С++ #include <iostream> using namespace std;
int main() { int k, n, res=0; cin >> k >> n; int *mas = new int[n];
for (int i=0; i!=n; i++) { cin >> mas[i];
if (mas[i] > k) { res = res + (mas[i] - k); } else { if (res!=0 ) { if ((k - mas[i]) > res) { res = 0; } else { res = res - (k - mas[i]); } } }
} cout << res; return 0; } Re: ответ на С++ Posted by Orient 17 Jan 2018 14:42 This is the mean. Edited by author 17.01.2018 14:44 |
|
|