2023 rcpc

This commit is contained in:
2024-04-22 16:45:09 +03:00
parent a0ddb657b7
commit 156202ada0
61 changed files with 4462 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#warning That's the baby, that's not my baby
typedef long long ll;
void solve() {
int n;
std::cin >> n;
ll sum = 0;
int maxi = 0;
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
if (i != n - 1) {
sum += x;
maxi = std::max(maxi, x);
}
}
std::cout << sum - maxi << '\n';
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}