CF EDU 130, finished a and b

This commit is contained in:
2022-06-18 17:07:46 +02:00
parent 1b058a01f3
commit 27d00340b9
6 changed files with 186 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
#include <bits/stdc++.h>
using namespace std;
void test_case(int tc){
int n, m;
cin >> n >> m;
int distance = 0;
for(int i = 0; i < n; ++i){
int a;
cin >> a;
distance += a;
}
cout << max(0, distance - m) << '\n';
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
for(int tc = 1; tc <= t; ++tc){
test_case(tc);
}
cout << flush;
return 0;
}