結果

問題 No.1352 Three Coins
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-01-17 13:27:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 244,600 KB
最終ジャッジ日時 2023-08-24 23:02:52
合計ジャッジ時間 5,375 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,140 KB
testcase_01 AC 71 ms
71,604 KB
testcase_02 AC 111 ms
76,128 KB
testcase_03 AC 77 ms
76,284 KB
testcase_04 AC 78 ms
75,900 KB
testcase_05 AC 84 ms
80,108 KB
testcase_06 AC 87 ms
82,468 KB
testcase_07 AC 72 ms
71,532 KB
testcase_08 AC 89 ms
83,348 KB
testcase_09 AC 79 ms
76,892 KB
testcase_10 AC 81 ms
79,532 KB
testcase_11 AC 79 ms
77,804 KB
testcase_12 AC 71 ms
71,484 KB
testcase_13 AC 79 ms
77,908 KB
testcase_14 AC 86 ms
83,360 KB
testcase_15 AC 81 ms
77,944 KB
testcase_16 AC 71 ms
71,256 KB
testcase_17 AC 77 ms
76,032 KB
testcase_18 AC 90 ms
89,632 KB
testcase_19 AC 69 ms
71,480 KB
testcase_20 AC 69 ms
71,124 KB
testcase_21 AC 92 ms
88,360 KB
testcase_22 AC 69 ms
71,316 KB
testcase_23 AC 71 ms
71,256 KB
testcase_24 AC 77 ms
75,828 KB
testcase_25 AC 71 ms
71,372 KB
testcase_26 AC 71 ms
71,440 KB
testcase_27 AC 72 ms
71,384 KB
testcase_28 AC 98 ms
94,452 KB
testcase_29 AC 76 ms
76,004 KB
testcase_30 AC 190 ms
225,636 KB
testcase_31 AC 84 ms
81,940 KB
testcase_32 AC 309 ms
244,600 KB
testcase_33 AC 77 ms
71,148 KB
testcase_34 AC 70 ms
71,276 KB
testcase_35 AC 73 ms
71,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""


"""

import sys
from sys import stdin
import math

A,B,C = map(int,stdin.readline().split())

if math.gcd(math.gcd(A,B),C) != 1:
    print ("INF")
    sys.exit()

mov = max(A,B,C)
dp = [False] * mov + [True]
ans = 0
streak = 0

while True:

    if streak > mov:
        break

    dp.append(dp[-A] or dp[-B] or dp[-C])
    if dp[-1] == True:
        streak += 1
    else:
        streak = 0
        ans += 1
print (ans)
0