Skip to content

Commit

Permalink
4466. 최대 성적표 만들기
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy8922 authored Mar 16, 2021
1 parent a21cca9 commit be225aa
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions 2021_03/SWEA_4466.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int T;
cin >> T;

for (int test_case = 1; test_case <= T; test_case++) {
int n, k;
cin >> n >> k;

vector<int> score(n);
for (int i = 0; i < n; i++) {
cin >> score[i];
}

int res = 0;
sort(score.begin(), score.end(), greater<int>());
for (int i = 0; i < k; i++) {
res += score[i];
}
cout << "#" << test_case << " " << res << endl;
}

return 0;
}

0 comments on commit be225aa

Please sign in to comment.