QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112280#6605. The WitchwoodzararazaCompile Error//C++17442b2023-06-11 01:18:402023-06-11 01:18:44

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:18:44]
  • 评测
  • [2023-06-11 01:18:40]
  • 提交

answer

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

#define int long long


int 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<int>());
    int s = 0; for (int i = 0; i < k; i++) s += mas[i];
    cout << s << endl;
    return 0;
}

Details

cc1plus: error: ‘::main’ must return ‘int’