結果
問題 |
No.1046 Fruits Rush
|
ユーザー |
![]() |
提出日時 | 2020-05-08 21:21:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 300 bytes |
コンパイル時間 | 348 ms |
コンパイル使用メモリ | 45,180 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 23:11:21 |
合計ジャッジ時間 | 862 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 3 |
ソースコード
#include <stdio.h> #include <algorithm> using namespace std; int n, k, a[111]; int main() { scanf ("%d %d", &n, &k); for (int i = 0; i < n; i++) scanf ("%d", &a[i]); sort(a, a + n); reverse(a, a + n); int r = 0; for (int i = 0; i < k; i++) r += max(a[i], 0); printf ("%d\n", r); return 0; }