QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112281#6605. The WitchwoodzararazaRE 0ms0kbC++17418b2023-06-11 01:19:522023-06-11 01:19:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-11 01:19:53]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-06-11 01:19:52]
  • 提交

answer

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

typedef long long ll;

ll mas[1050];

int main() {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> mas[i];
    sort(mas, mas + n, greater<ll>());
    ll s = 0; for (int i = 0; i < k; i++) s += mas[i];
    cout << s << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

5 2
9 8 10 2 4

output:


result: