結果

問題 No.1352 Three Coins
ユーザー rlangevinrlangevin
提出日時 2024-04-04 00:18:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 887 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 351,896 KB
最終ジャッジ日時 2024-04-04 00:19:01
合計ジャッジ時間 25,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 410 ms
351,768 KB
testcase_01 AC 547 ms
351,768 KB
testcase_02 AC 887 ms
351,896 KB
testcase_03 AC 860 ms
351,896 KB
testcase_04 AC 832 ms
351,896 KB
testcase_05 AC 799 ms
351,896 KB
testcase_06 AC 812 ms
351,896 KB
testcase_07 AC 430 ms
351,896 KB
testcase_08 AC 811 ms
351,896 KB
testcase_09 AC 774 ms
351,896 KB
testcase_10 AC 795 ms
351,896 KB
testcase_11 AC 806 ms
351,896 KB
testcase_12 AC 313 ms
351,896 KB
testcase_13 AC 875 ms
351,896 KB
testcase_14 AC 884 ms
351,896 KB
testcase_15 AC 792 ms
351,896 KB
testcase_16 AC 482 ms
351,896 KB
testcase_17 AC 777 ms
351,896 KB
testcase_18 AC 855 ms
351,896 KB
testcase_19 AC 456 ms
351,896 KB
testcase_20 AC 475 ms
351,896 KB
testcase_21 AC 787 ms
351,896 KB
testcase_22 AC 370 ms
351,896 KB
testcase_23 AC 296 ms
351,896 KB
testcase_24 AC 677 ms
351,896 KB
testcase_25 AC 388 ms
351,896 KB
testcase_26 AC 241 ms
351,896 KB
testcase_27 AC 660 ms
351,768 KB
testcase_28 AC 853 ms
351,896 KB
testcase_29 AC 824 ms
351,896 KB
testcase_30 AC 637 ms
351,896 KB
testcase_31 AC 710 ms
351,768 KB
testcase_32 AC 537 ms
351,768 KB
testcase_33 AC 153 ms
351,768 KB
testcase_34 AC 314 ms
351,768 KB
testcase_35 AC 674 ms
351,896 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