結果

問題 No.27 板の準備
ユーザー noriocnorioc
提出日時 2022-04-08 10:48:30
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,066 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 7,900 KB
最終ジャッジ日時 2023-08-18 20:13:07
合計ジャッジ時間 10,164 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
7,756 KB
testcase_01 AC 120 ms
7,676 KB
testcase_02 AC 371 ms
7,744 KB
testcase_03 AC 158 ms
7,748 KB
testcase_04 AC 520 ms
7,816 KB
testcase_05 AC 432 ms
7,760 KB
testcase_06 AC 732 ms
7,820 KB
testcase_07 AC 756 ms
7,900 KB
testcase_08 AC 1,066 ms
7,748 KB
testcase_09 AC 818 ms
7,748 KB
testcase_10 AC 575 ms
7,732 KB
testcase_11 AC 489 ms
7,748 KB
testcase_12 AC 583 ms
7,744 KB
testcase_13 AC 449 ms
7,764 KB
testcase_14 AC 345 ms
7,680 KB
testcase_15 AC 539 ms
7,780 KB
testcase_16 AC 200 ms
7,680 KB
testcase_17 AC 520 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1 << 60


def calc(a, b, c, x):
    dp = [INF] * 31
    for s in [a, b, c]:
        dp[s] = 1
        for t in range(s+1, x+1):
            dp[t] = min(dp[t], dp[t-s] + 1)
    return dp[x]


v = list(map(int, input().split()))
ans = INF
for i in range(1, 31):
    for j in range(1, 31):
        for k in range(1, 31):
            ans = min(ans, sum(calc(i, j, k, x) for x in v))
print(ans)
0