結果

問題 No.1046 Fruits Rush
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-05-08 21:22:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 71,532 KB
最終ジャッジ日時 2023-09-17 01:09:12
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,424 KB
testcase_01 AC 69 ms
71,532 KB
testcase_02 AC 70 ms
71,296 KB
testcase_03 AC 69 ms
71,340 KB
testcase_04 AC 69 ms
71,216 KB
testcase_05 AC 68 ms
71,352 KB
testcase_06 AC 69 ms
71,088 KB
testcase_07 AC 69 ms
71,080 KB
testcase_08 AC 68 ms
71,136 KB
testcase_09 AC 69 ms
71,280 KB
testcase_10 AC 70 ms
71,424 KB
testcase_11 AC 69 ms
71,340 KB
testcase_12 AC 69 ms
71,420 KB
testcase_13 AC 70 ms
71,284 KB
testcase_14 AC 69 ms
71,340 KB
testcase_15 AC 70 ms
71,240 KB
testcase_16 AC 69 ms
71,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())

A = list(map(int,input().split()))

A.sort()
A.reverse()

ans = 0
for i in range(K):
    if i != 0 and A[i] < 0:
        pass
    else:
        ans += A[i]
print (ans)
0