結果

問題 No.1046 Fruits Rush
ユーザー tomoyaatcodertomoyaatcoder
提出日時 2020-07-25 18:55:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 195 bytes
コンパイル時間 997 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 71,192 KB
最終ジャッジ日時 2023-09-09 20:07:05
合計ジャッジ時間 2,562 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,084 KB
testcase_01 AC 73 ms
70,992 KB
testcase_02 AC 72 ms
70,824 KB
testcase_03 AC 71 ms
70,904 KB
testcase_04 AC 72 ms
70,940 KB
testcase_05 AC 73 ms
71,180 KB
testcase_06 AC 73 ms
71,128 KB
testcase_07 AC 72 ms
70,992 KB
testcase_08 AC 72 ms
71,032 KB
testcase_09 AC 72 ms
71,192 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 72 ms
71,008 KB
testcase_12 AC 70 ms
71,024 KB
testcase_13 AC 73 ms
70,996 KB
testcase_14 AC 73 ms
71,040 KB
testcase_15 AC 72 ms
71,028 KB
testcase_16 AC 70 ms
71,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
if a[0] <= 0:
    ans = a[0]
else:
    for i in range(k):
        ans += max(0, a[i])
print(ans)
0