結果

問題 No.1352 Three Coins
ユーザー H3PO4H3PO4
提出日時 2021-01-17 13:30:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 94,816 KB
最終ジャッジ日時 2024-05-07 05:53:19
合計ジャッジ時間 3,616 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,468 KB
testcase_01 AC 40 ms
53,324 KB
testcase_02 AC 55 ms
64,048 KB
testcase_03 AC 54 ms
64,336 KB
testcase_04 AC 51 ms
64,052 KB
testcase_05 AC 62 ms
67,884 KB
testcase_06 AC 110 ms
78,132 KB
testcase_07 AC 39 ms
52,204 KB
testcase_08 AC 126 ms
80,348 KB
testcase_09 AC 59 ms
65,420 KB
testcase_10 AC 66 ms
66,784 KB
testcase_11 AC 53 ms
63,252 KB
testcase_12 AC 38 ms
52,652 KB
testcase_13 AC 59 ms
64,548 KB
testcase_14 AC 126 ms
77,064 KB
testcase_15 AC 59 ms
65,272 KB
testcase_16 AC 40 ms
53,760 KB
testcase_17 AC 49 ms
63,048 KB
testcase_18 AC 61 ms
65,212 KB
testcase_19 AC 39 ms
52,672 KB
testcase_20 AC 38 ms
53,572 KB
testcase_21 AC 164 ms
86,172 KB
testcase_22 AC 39 ms
53,080 KB
testcase_23 AC 39 ms
52,096 KB
testcase_24 AC 51 ms
63,644 KB
testcase_25 AC 39 ms
52,716 KB
testcase_26 AC 39 ms
53,936 KB
testcase_27 WA -
testcase_28 AC 133 ms
78,804 KB
testcase_29 WA -
testcase_30 AC 180 ms
94,816 KB
testcase_31 WA -
testcase_32 AC 132 ms
94,380 KB
testcase_33 AC 39 ms
53,776 KB
testcase_34 AC 39 ms
52,888 KB
testcase_35 AC 39 ms
52,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

A, B, C = map(int, input().split())

if gcd(gcd(A, B), C) != 1:
    print('INF')
    exit()

table = [False] * min(A * B, B * C, C * A)
L = len(table)
MAX = A * B * C

for i in range(MAX):
    if A * i >= L:
        break
    if table[A * i]:
        break
    for j in range(MAX):
        if A * i + B * j >= L:
            break
        if table[A * i + B * j]:
            break
        for k in range(MAX):
            if A * i + B * j + C * k >= L:
                break
            if table[A * i + B * j + C * k]:
                break
            table[A * i + B * j + C * k] = True
print(table.count(False))
0