結果

問題 No.1046 Fruits Rush
ユーザー Kanten4205Kanten4205
提出日時 2020-07-05 20:58:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 1,918 ms
コンパイル使用メモリ 172,564 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-24 04:31:36
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N, K; cin >> N >> K;
	vector<long long>A(N);
	for (long long i = 0; i < N; i++)
		cin >> A.at(i);
	sort(A.begin(), A.end(), greater<long long>());
	long long ans = 0;
	for (long long i = 0; i < K; i++)
		ans += A.at(i);
	cout << ans << endl;
}
0