結果

問題 No.27 板の準備
ユーザー nebukuro09nebukuro09
提出日時 2016-09-28 14:58:51
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 1,273 ms
コンパイル使用メモリ 77,200 KB
実行使用メモリ 80,016 KB
最終ジャッジ日時 2023-08-27 04:36:39
合計ジャッジ時間 4,834 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
79,796 KB
testcase_01 AC 137 ms
79,968 KB
testcase_02 AC 139 ms
79,796 KB
testcase_03 AC 140 ms
79,808 KB
testcase_04 AC 144 ms
79,968 KB
testcase_05 AC 141 ms
79,976 KB
testcase_06 AC 143 ms
79,820 KB
testcase_07 AC 143 ms
80,016 KB
testcase_08 AC 144 ms
79,752 KB
testcase_09 AC 144 ms
79,980 KB
testcase_10 AC 142 ms
79,944 KB
testcase_11 AC 142 ms
80,008 KB
testcase_12 AC 145 ms
79,980 KB
testcase_13 AC 141 ms
79,804 KB
testcase_14 AC 140 ms
79,940 KB
testcase_15 AC 139 ms
79,996 KB
testcase_16 AC 138 ms
79,960 KB
testcase_17 AC 143 ms
79,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

V = map(int, raw_input().split())

def solve(a, b, c):
    dp = [float('inf') for i in xrange(31)]
    dp[0] = 0
    for i in xrange(a, 31):
        if i - a >= 0:
            dp[i] = min(dp[i], dp[i-a]+1)
        if i - b >= 0:
            dp[i] = min(dp[i], dp[i-b]+1)
        if i - c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1)
    return dp[V[0]]+dp[V[1]]+dp[V[2]]+dp[V[3]]

ans = float('inf')
for a in xrange(1, 31):
    for b in xrange(a+1, 31):
        for c in xrange(b+1, 31):
            ans = min(ans, solve(a, b, c))
print ans
0