結果

問題 No.1352 Three Coins
ユーザー H3PO4H3PO4
提出日時 2021-01-17 13:42:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 86,324 KB
実行使用メモリ 107,444 KB
最終ジャッジ日時 2023-08-24 23:04:10
合計ジャッジ時間 5,792 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,136 KB
testcase_01 AC 77 ms
75,844 KB
testcase_02 AC 94 ms
78,740 KB
testcase_03 AC 127 ms
84,920 KB
testcase_04 AC 89 ms
78,192 KB
testcase_05 AC 186 ms
96,548 KB
testcase_06 AC 183 ms
97,108 KB
testcase_07 AC 72 ms
71,192 KB
testcase_08 AC 164 ms
94,760 KB
testcase_09 AC 102 ms
81,260 KB
testcase_10 AC 130 ms
87,532 KB
testcase_11 AC 135 ms
87,700 KB
testcase_12 AC 71 ms
70,960 KB
testcase_13 AC 111 ms
83,232 KB
testcase_14 AC 170 ms
93,440 KB
testcase_15 AC 115 ms
84,824 KB
testcase_16 AC 71 ms
71,212 KB
testcase_17 AC 87 ms
77,556 KB
testcase_18 AC 120 ms
84,396 KB
testcase_19 AC 72 ms
71,272 KB
testcase_20 AC 70 ms
71,408 KB
testcase_21 AC 200 ms
101,884 KB
testcase_22 AC 72 ms
70,960 KB
testcase_23 AC 72 ms
71,160 KB
testcase_24 AC 81 ms
76,120 KB
testcase_25 AC 71 ms
71,216 KB
testcase_26 AC 71 ms
71,408 KB
testcase_27 AC 72 ms
71,032 KB
testcase_28 AC 243 ms
104,396 KB
testcase_29 AC 87 ms
76,964 KB
testcase_30 AC 211 ms
107,444 KB
testcase_31 AC 80 ms
76,388 KB
testcase_32 AC 166 ms
107,068 KB
testcase_33 AC 72 ms
71,308 KB
testcase_34 AC 78 ms
75,724 KB
testcase_35 AC 79 ms
76,252 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] * max(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