0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 16:38:47 +00:00

A - Parkway Walk

https://codeforces.com/contest/1697/submission/160286588
This commit is contained in:
Baoshuo Ren 2022-06-12 22:41:19 +08:00
parent ee51206c3f
commit 5f455c9296
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

37
Codeforces/1697/A/A.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 105;
int t, n, m;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
cin >> n >> m;
int ans = 0;
for (int i = 1, x; i <= n; i++) {
cin >> x;
m -= x;
if (m < 0) {
ans += -m;
m = 0;
}
}
cout << ans << endl;
}
return 0;
}