Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- ll int n, m;
- cin>>n>>m;
- vector<ll int> a(m);
- for(auto &e: a) cin>>e;
- ll int tot = accumulate(a.begin(), a.end(), 0ll);
- ll int mmin = (m-1)*1ll*n;
- cout<<max(0ll, tot-mmin)<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment