結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-17 17:02:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 361 bytes |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 53,784 KB |
| 最終ジャッジ日時 | 2024-12-15 22:38:51 |
| 合計ジャッジ時間 | 1,871 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 6 |
ソースコード
#!/usr/bin/env python
indat = [int(x) for x in input().split()]
weights = []
for i in range(indat[0]):
weights.append(int(input()))
weights.sort()
weights.reverse()
ans = 0
for weight in weights:
ans += weight
if ans == indat[1]:
break
elif ans > indat[1]:
ans -= weight
continue
else:
continue
print(ans)