mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
4f6248c621
commit
80c012b77b
22
S2OJ/16/16.cpp
Normal file
22
S2OJ/16/16.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
long long t, n, k, a[5005], ans;
|
||||
|
||||
int main() {
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
ans = 0;
|
||||
cin >> n >> k;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
sort(a, a + n, greater<long long>());
|
||||
for (int i = k; i < n; i++) {
|
||||
ans += a[i];
|
||||
}
|
||||
cout << max(ans, a[0]) << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user