結果

問題 No.1046 Fruits Rush
ユーザー ABKZABKZ
提出日時 2021-08-01 12:35:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 71,484 KB
最終ジャッジ日時 2023-10-14 18:45:00
合計ジャッジ時間 2,712 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,216 KB
testcase_01 AC 77 ms
71,420 KB
testcase_02 AC 76 ms
71,304 KB
testcase_03 AC 78 ms
71,188 KB
testcase_04 AC 77 ms
70,956 KB
testcase_05 AC 77 ms
71,212 KB
testcase_06 AC 77 ms
71,056 KB
testcase_07 AC 76 ms
71,148 KB
testcase_08 AC 76 ms
71,216 KB
testcase_09 AC 76 ms
71,256 KB
testcase_10 AC 77 ms
71,060 KB
testcase_11 AC 75 ms
71,128 KB
testcase_12 AC 79 ms
71,184 KB
testcase_13 AC 77 ms
71,140 KB
testcase_14 AC 78 ms
71,104 KB
testcase_15 AC 77 ms
71,104 KB
testcase_16 AC 77 ms
71,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

ans = 0
for i in range(K):
    if A[i] > 0:
        ans += A[i]
    else:
        if i == 0:
            ans += A[i]
        break

print(ans)
0