結果

問題 No.27 板の準備
ユーザー 👑 colognecologne
提出日時 2022-01-23 02:04:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 77,968 KB
最終ジャッジ日時 2023-08-19 02:18:22
合計ジャッジ時間 3,236 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 59 ms
71,240 KB
testcase_02 AC 87 ms
77,368 KB
testcase_03 AC 61 ms
75,776 KB
testcase_04 AC 92 ms
77,560 KB
testcase_05 AC 79 ms
77,360 KB
testcase_06 AC 94 ms
77,740 KB
testcase_07 AC 102 ms
77,840 KB
testcase_08 AC 105 ms
77,860 KB
testcase_09 AC 97 ms
77,600 KB
testcase_10 AC 96 ms
77,524 KB
testcase_11 AC 86 ms
77,340 KB
testcase_12 AC 95 ms
77,420 KB
testcase_13 AC 90 ms
77,512 KB
testcase_14 AC 81 ms
77,388 KB
testcase_15 AC 96 ms
77,968 KB
testcase_16 AC 71 ms
75,904 KB
testcase_17 AC 99 ms
77,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline


def main():
    x, y, z, w = map(int, input().split())
    M = max(x, y, z, w)
    ans = float('inf')
    for a in range(1, M+1):
        for b in range(1, a):
            for c in range(1, b):
                D = [0] + [float('inf')]*M
                for i in range(M):
                    for j in [a, b, c]:
                        if i+j <= M:
                            D[i+j] = min(D[i+j], D[i]+1)
                ans = min(ans, D[x]+D[y]+D[z]+D[w])
    print(ans)


if __name__ == '__main__':
    main()
0