結果

問題 No.1046 Fruits Rush
ユーザー pypypymi
提出日時 2022-02-12 09:48:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 233 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-06-28 11:26:25
合計ジャッジ時間 1,613 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 12 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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