結果

問題 No.27 板の準備
ユーザー OKCH3COOHOKCH3COOH
提出日時 2019-10-25 19:05:27
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 436 ms / 5,000 ms
コード長 514 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 7,896 KB
最終ジャッジ日時 2023-09-28 13:09:30
合計ジャッジ時間 5,947 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
7,760 KB
testcase_01 AC 117 ms
7,776 KB
testcase_02 AC 195 ms
7,804 KB
testcase_03 AC 143 ms
7,896 KB
testcase_04 AC 270 ms
7,788 KB
testcase_05 AC 243 ms
7,744 KB
testcase_06 AC 334 ms
7,788 KB
testcase_07 AC 328 ms
7,732 KB
testcase_08 AC 436 ms
7,792 KB
testcase_09 AC 355 ms
7,808 KB
testcase_10 AC 282 ms
7,868 KB
testcase_11 AC 251 ms
7,772 KB
testcase_12 AC 284 ms
7,800 KB
testcase_13 AC 235 ms
7,772 KB
testcase_14 AC 193 ms
7,816 KB
testcase_15 AC 261 ms
7,784 KB
testcase_16 AC 150 ms
7,880 KB
testcase_17 AC 260 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def f(A, B, C):
    ret = 0
    for v in V:
        cnt = float('inf')
        for a in range(v // A + 1):
            for b in range(v // B + 1):
                l = A * a + B * b
                if (v - l) >= 0 and (v - l) % C == 0:
                    cnt = min(cnt, a + b + (v - l) // C)
        ret += cnt
    return ret

ans = float('inf')
for a in range(1, 31):
    for b in range(1, 31):
        for c in range(1, 31):
            ans = min(ans, f(a, b, c))

print(ans)
0