mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 14:18:47 +00:00
A - Parkway Walk
https://codeforces.com/contest/1697/submission/160286588
This commit is contained in:
parent
ee51206c3f
commit
5f455c9296
37
Codeforces/1697/A/A.cpp
Normal file
37
Codeforces/1697/A/A.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user