結果

問題 No.27 板の準備
ユーザー kohei2019kohei2019
提出日時 2021-02-10 17:53:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 78,468 KB
最終ジャッジ日時 2023-09-22 12:37:11
合計ジャッジ時間 4,023 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
78,000 KB
testcase_01 AC 127 ms
77,800 KB
testcase_02 AC 140 ms
78,324 KB
testcase_03 AC 138 ms
78,468 KB
testcase_04 AC 128 ms
77,960 KB
testcase_05 AC 128 ms
77,808 KB
testcase_06 AC 129 ms
78,100 KB
testcase_07 AC 133 ms
77,732 KB
testcase_08 AC 130 ms
78,040 KB
testcase_09 AC 131 ms
78,036 KB
testcase_10 AC 117 ms
78,016 KB
testcase_11 AC 128 ms
77,876 KB
testcase_12 AC 130 ms
77,920 KB
testcase_13 AC 124 ms
77,840 KB
testcase_14 AC 122 ms
77,984 KB
testcase_15 AC 132 ms
77,720 KB
testcase_16 AC 122 ms
78,008 KB
testcase_17 AC 129 ms
77,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

lsV = list(map(int,input().split()))
#30**3で全探索A,B,C
#A,B,CをつかってVを作るDP
ans = float('INF')
for i in range(1,29):
    for j in range(i+1,30):
        for k in range(j+1,31):
            dp = [float('INF')]*(30+1)
            dp[0] = 0
            lsABC = [i,j,k]
            for l in lsABC:
                for m in range(31):
                    if m+l < 31:
                        dp[m+l] = min(dp[m+l],dp[m]+1)
            cnt = 0
            for V in lsV:
                cnt += dp[V]
            ans = min(cnt,ans)
print(ans)
0