QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112279#6605. The WitchwoodzararazaCompile Error//C++17427b2023-06-11 01:17:552023-06-11 01:17:56

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:17:56]
  • 评测
  • [2023-06-11 01:17:55]
  • 提交

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;
}

Details

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