結果
問題 | No.1046 Fruits Rush |
ユーザー |
|
提出日時 | 2022-02-24 23:18:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 199 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 52,096 KB |
最終ジャッジ日時 | 2024-07-02 14:14:21 |
合計ジャッジ時間 | 1,667 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
n,k = map(int,input().split()) an = sorted(map(int,input().split()))[::-1] value = [an[0]] count=1 for i in an[1:]: if i>0 and count<k: count+=1 value.append(i) else: break print(sum(value))