結果

問題 No.27 板の準備
ユーザー しらっ亭しらっ亭
提出日時 2015-08-15 03:50:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 8,268 KB
最終ジャッジ日時 2023-09-25 11:54:01
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
8,192 KB
testcase_02 AC 144 ms
8,124 KB
testcase_03 AC 17 ms
8,264 KB
testcase_04 AC 137 ms
8,228 KB
testcase_05 AC 83 ms
8,112 KB
testcase_06 AC 201 ms
8,104 KB
testcase_07 AC 299 ms
8,112 KB
testcase_08 AC 405 ms
8,104 KB
testcase_09 AC 316 ms
8,212 KB
testcase_10 AC 211 ms
8,096 KB
testcase_11 AC 106 ms
8,264 KB
testcase_12 AC 175 ms
8,236 KB
testcase_13 AC 122 ms
8,244 KB
testcase_14 AC 71 ms
8,112 KB
testcase_15 AC 192 ms
8,232 KB
testcase_16 AC 21 ms
8,252 KB
testcase_17 AC 242 ms
8,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations


def c(v, a):
    dp = [float('inf')] * (v + max(a))
    dp[0] = 0
    for i in range(v):
        for b in a:
            dp[i + b] = min(dp[i + b], dp[i] + 1)
    return dp[v]


def solve():
    V = list(map(int, input().split()))

    mi = float('inf')
    for ijk in combinations(range(1, max(V) + 1), 3):
        mi = min(mi, sum(c(V[l], ijk) for l in range(4)))
    print(mi)


if __name__ == '__main__':
    solve()
0