結果

問題 No.1046 Fruits Rush
ユーザー pypypymipypypymi
提出日時 2022-02-12 09:48:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 233 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 71,564 KB
最終ジャッジ日時 2023-09-10 20:20:43
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 77 ms
71,024 KB
testcase_02 AC 76 ms
70,888 KB
testcase_03 AC 76 ms
70,856 KB
testcase_04 WA -
testcase_05 AC 76 ms
70,888 KB
testcase_06 AC 75 ms
71,128 KB
testcase_07 AC 77 ms
70,952 KB
testcase_08 AC 75 ms
71,164 KB
testcase_09 WA -
testcase_10 AC 77 ms
71,060 KB
testcase_11 AC 76 ms
70,864 KB
testcase_12 AC 78 ms
70,816 KB
testcase_13 AC 76 ms
71,088 KB
testcase_14 AC 79 ms
70,704 KB
testcase_15 AC 76 ms
70,992 KB
testcase_16 AC 78 ms
70,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
an = sorted(list(map(int,input().split())))[::-1]
count = an[0]
i_c = 0
for i in range(1,len(an)):
    if an[i]<0 or i_c>k:
        break
    else:
        count+=an[i]
        i_c+=1
print(count)

    
0