結果

問題 No.1352 Three Coins
ユーザー mkawa2mkawa2
提出日時 2023-04-18 18:30:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 136,960 KB
最終ジャッジ日時 2024-04-21 19:14:37
合計ジャッジ時間 3,884 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 43 ms
58,880 KB
testcase_02 AC 59 ms
76,928 KB
testcase_03 AC 51 ms
69,632 KB
testcase_04 AC 49 ms
62,848 KB
testcase_05 WA -
testcase_06 AC 148 ms
110,720 KB
testcase_07 AC 37 ms
51,840 KB
testcase_08 AC 147 ms
111,488 KB
testcase_09 AC 80 ms
85,632 KB
testcase_10 AC 108 ms
96,512 KB
testcase_11 AC 113 ms
98,856 KB
testcase_12 AC 39 ms
52,480 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 38 ms
52,096 KB
testcase_17 AC 55 ms
75,648 KB
testcase_18 AC 91 ms
89,984 KB
testcase_19 AC 38 ms
52,352 KB
testcase_20 AC 38 ms
52,096 KB
testcase_21 AC 174 ms
123,648 KB
testcase_22 AC 38 ms
51,840 KB
testcase_23 AC 38 ms
52,608 KB
testcase_24 AC 48 ms
62,848 KB
testcase_25 AC 39 ms
52,736 KB
testcase_26 AC 38 ms
52,096 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 182 ms
136,960 KB
testcase_31 AC 50 ms
66,816 KB
testcase_32 AC 154 ms
136,960 KB
testcase_33 AC 38 ms
51,840 KB
testcase_34 AC 44 ms
59,520 KB
testcase_35 AC 38 ms
52,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

from math import gcd

a, b, c = LI()
g = gcd(a, b)

if gcd(g, c) > 1:
    print("INF")
    exit()

a //= g
b //= g
mx = max((a-1)*(b-1)*g, (g-1)*(c-1))
dp = [1]+[0]*mx
for i in range(mx):
    if dp[i] == 0: continue
    for d in [a, b, c]:
        if i+d <= mx: dp[i+d] = 1

print(dp.count(0))
0