結果

問題 No.1352 Three Coins
ユーザー H3PO4H3PO4
提出日時 2021-01-17 13:34:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 86,536 KB
実行使用メモリ 107,860 KB
最終ジャッジ日時 2023-08-19 22:54:42
合計ジャッジ時間 6,442 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,260 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 103 ms
77,372 KB
testcase_03 AC 86 ms
76,996 KB
testcase_04 AC 84 ms
76,404 KB
testcase_05 AC 94 ms
78,672 KB
testcase_06 AC 142 ms
88,436 KB
testcase_07 AC 72 ms
71,124 KB
testcase_08 AC 155 ms
92,232 KB
testcase_09 AC 91 ms
78,176 KB
testcase_10 AC 97 ms
80,560 KB
testcase_11 AC 85 ms
77,556 KB
testcase_12 AC 71 ms
71,352 KB
testcase_13 WA -
testcase_14 AC 158 ms
89,744 KB
testcase_15 AC 91 ms
78,036 KB
testcase_16 AC 72 ms
71,364 KB
testcase_17 AC 81 ms
76,316 KB
testcase_18 AC 88 ms
78,492 KB
testcase_19 AC 71 ms
71,368 KB
testcase_20 AC 69 ms
71,452 KB
testcase_21 AC 174 ms
97,872 KB
testcase_22 AC 72 ms
71,148 KB
testcase_23 AC 71 ms
71,328 KB
testcase_24 AC 82 ms
76,240 KB
testcase_25 AC 71 ms
71,556 KB
testcase_26 AC 71 ms
71,276 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 209 ms
107,732 KB
testcase_31 WA -
testcase_32 AC 163 ms
107,860 KB
testcase_33 AC 71 ms
71,348 KB
testcase_34 AC 71 ms
71,320 KB
testcase_35 AC 73 ms
71,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

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

if gcd(A, B) != 1 and gcd(B, C) != 1 and gcd(C, A) != 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