結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-18 20:20:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 453 bytes |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 75,428 KB |
| 最終ジャッジ日時 | 2024-12-16 00:28:39 |
| 合計ジャッジ時間 | 2,168 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 1 |
| other | AC * 13 RE * 7 |
ソースコード
#!/usr/bin/env python
indat = [int(x) for x in input().split()]
weights = list()
for i in range(indat[0]):
x = int(input())
if x < indat[1]:
weights.append(x)
elif x == indat[1]:
print(x)
exit()
def rec(i,j):
if i == indat[0]:
res = 0
elif j < weights[i]:
res = rec(i+1,j)
else:
res = max(rec(i+1, j), rec(i+1, j-weights[i]) + weights[i])
return res
print(rec(0, indat[1]))