結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
蕎麦屋
|
| 提出日時 | 2020-05-08 21:52:45 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 249 bytes |
| 記録 | |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2026-03-25 08:33:04 |
| 合計ジャッジ時間 | 1,140 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
count = 0
ans = 0
for i in a:
if((i>=1 and count<k) or count == 0):
count+=1
ans+=i
if(i<=0):
break
#print(a)
print(ans)
蕎麦屋