結果

問題 No.1352 Three Coins
ユーザー H3PO4H3PO4
提出日時 2021-01-17 13:30:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 107,884 KB
最終ジャッジ日時 2023-08-19 22:52:33
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,476 KB
testcase_01 AC 70 ms
71,520 KB
testcase_02 AC 88 ms
77,876 KB
testcase_03 AC 84 ms
77,376 KB
testcase_04 AC 78 ms
76,740 KB
testcase_05 AC 91 ms
78,896 KB
testcase_06 AC 131 ms
88,884 KB
testcase_07 AC 69 ms
71,744 KB
testcase_08 AC 137 ms
92,272 KB
testcase_09 AC 87 ms
78,644 KB
testcase_10 AC 96 ms
80,572 KB
testcase_11 AC 83 ms
78,060 KB
testcase_12 AC 69 ms
71,428 KB
testcase_13 AC 87 ms
78,200 KB
testcase_14 AC 134 ms
89,708 KB
testcase_15 AC 87 ms
77,960 KB
testcase_16 AC 70 ms
71,160 KB
testcase_17 AC 78 ms
76,396 KB
testcase_18 AC 87 ms
79,000 KB
testcase_19 AC 70 ms
71,548 KB
testcase_20 AC 69 ms
71,400 KB
testcase_21 AC 162 ms
98,384 KB
testcase_22 AC 71 ms
71,160 KB
testcase_23 AC 69 ms
71,328 KB
testcase_24 AC 81 ms
76,716 KB
testcase_25 AC 70 ms
71,548 KB
testcase_26 AC 69 ms
71,548 KB
testcase_27 WA -
testcase_28 AC 139 ms
91,360 KB
testcase_29 WA -
testcase_30 AC 185 ms
107,884 KB
testcase_31 WA -
testcase_32 AC 159 ms
107,644 KB
testcase_33 AC 70 ms
71,556 KB
testcase_34 AC 68 ms
71,304 KB
testcase_35 AC 69 ms
71,116 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