結果

問題 No.1352 Three Coins
ユーザー rlangevinrlangevin
提出日時 2024-04-04 00:17:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 351,940 KB
最終ジャッジ日時 2024-04-04 00:17:52
合計ジャッジ時間 26,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 430 ms
351,768 KB
testcase_01 AC 576 ms
351,768 KB
testcase_02 AC 892 ms
351,924 KB
testcase_03 AC 902 ms
351,924 KB
testcase_04 AC 841 ms
351,924 KB
testcase_05 AC 864 ms
351,924 KB
testcase_06 AC 764 ms
351,924 KB
testcase_07 WA -
testcase_08 AC 773 ms
351,924 KB
testcase_09 AC 765 ms
351,924 KB
testcase_10 AC 824 ms
351,924 KB
testcase_11 AC 781 ms
351,920 KB
testcase_12 WA -
testcase_13 AC 897 ms
351,924 KB
testcase_14 AC 899 ms
351,924 KB
testcase_15 AC 836 ms
351,924 KB
testcase_16 WA -
testcase_17 AC 815 ms
351,920 KB
testcase_18 AC 815 ms
351,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 807 ms
351,924 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 694 ms
351,920 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 668 ms
351,792 KB
testcase_28 AC 877 ms
351,924 KB
testcase_29 AC 813 ms
351,924 KB
testcase_30 AC 688 ms
351,924 KB
testcase_31 AC 716 ms
351,792 KB
testcase_32 AC 559 ms
351,804 KB
testcase_33 WA -
testcase_34 AC 347 ms
351,792 KB
testcase_35 AC 626 ms
351,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, C = map(int, input().split())
M = 5000
M2 = M * M
dp = [0] * M2
a = 0
while a < M2:
    b = 0
    if dp[a]:
        break
    while a + b < M2:
        c = 0
        if dp[a + b]:
            break
        while a + b + c < M2:
            if dp[a + b + c]:
                break
            else:
                dp[a + b + c] = 1
                c += C
        b += B
    a += A
    
if 0 in dp[M2//2:]:
    print("inf")
else:
    print(dp.count(0))
0