結果

問題 No.1046 Fruits Rush
ユーザー raven7959
提出日時 2021-08-09 08:53:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 205 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 53,424 KB
最終ジャッジ日時 2024-09-21 07:26:06
合計ジャッジ時間 1,496 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
if A[0]<0:
    print(A[0])
else:
    ans=0
    for i in range(K):
        if A[i]>=0:
            ans+=A[i]
    print(ans)
0