結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-07-21 22:02:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-26 05:04:26 |
合計ジャッジ時間 | 2,155 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 34 |
ソースコード
import pulp W = [] L = int(input()) #箱の幅 N = int(input()) #ブロックの数 W = input().split() #各ブロックの幅 problem = pulp.LpProblem('No.5', pulp.LpMaximize) # 最大化する場合 xs = range(N) x = pulp.LpVariable.dicts("x", (xs), 0, 1, pulp.LpInteger) problem += pulp.lpSum([x[i]]for i in range(N)) problem += pulp.lpSum([int(W[i])*x[i]for i in range(N)]) <= L problem.solve() status = problem.solve() count = 0 for i in range(N): count += x[i].value() print(int(count))