結果

問題 No.27 板の準備
ユーザー rlangevinrlangevin
提出日時 2023-07-24 12:05:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 573 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,016 KB
最終ジャッジ日時 2024-04-08 14:43:35
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,016 KB
testcase_01 AC 86 ms
76,016 KB
testcase_02 AC 86 ms
76,016 KB
testcase_03 AC 86 ms
76,016 KB
testcase_04 AC 86 ms
76,016 KB
testcase_05 AC 87 ms
76,016 KB
testcase_06 AC 85 ms
76,016 KB
testcase_07 AC 88 ms
76,016 KB
testcase_08 AC 86 ms
76,016 KB
testcase_09 AC 86 ms
76,016 KB
testcase_10 AC 85 ms
76,016 KB
testcase_11 AC 84 ms
76,016 KB
testcase_12 AC 85 ms
76,016 KB
testcase_13 AC 86 ms
76,016 KB
testcase_14 AC 87 ms
76,016 KB
testcase_15 AC 85 ms
76,016 KB
testcase_16 AC 85 ms
76,016 KB
testcase_17 AC 86 ms
76,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

V = list(map(int, input().split()))

def f(A):
    inf = 10 ** 18
    pre = [inf] * 31
    pre[0] = 0
    for i in range(3):
        dp = [inf] * 31
        for j in range(31):
            dp[j] = pre[j]
            if j - A[i] >= 0:
                dp[j] = min(dp[j], dp[j - A[i]] + 1)
        dp, pre = pre, dp
    return pre

ans = 10 ** 18
for a in range(1, 31):
    for b in range(a, 31):
        for c in range(b, 31):
            D = f([a, b, c])
            temp = 0
            for v in V:
                temp += D[v]
            ans = min(ans, temp)


print(ans)
0