結果
問題 |
No.617 Nafmo、買い出しに行く
|
ユーザー |
|
提出日時 | 2017-12-17 20:20:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 394 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-15 22:53:38 |
合計ジャッジ時間 | 2,075 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 20 |
ソースコード
#!/usr/bin/env python import pulp def maximize(capacity, weight): r = range(len(weight)) problem = pulp.LpProblem(sense=pulp.LpMaximize) variable = [pulp.LpVariable('x%d'%i, cat=pulp.LpBinary) for i in r] problem += pulp.lpDot(weight, variable) problem += pulp.lpDot(weight, variable) <= capacity problem.solve() return pulp.value(problem.objective) 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() ans = int(maximize(indat[1], weights)) print(ans)