結果

問題 No.1352 Three Coins
ユーザー GER_chenGER_chen
提出日時 2021-01-17 17:55:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 76,784 KB
最終ジャッジ日時 2023-08-24 23:07:40
合計ジャッジ時間 4,800 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,520 KB
testcase_01 AC 73 ms
71,480 KB
testcase_02 AC 82 ms
76,404 KB
testcase_03 AC 83 ms
76,552 KB
testcase_04 AC 82 ms
76,020 KB
testcase_05 AC 83 ms
75,940 KB
testcase_06 AC 92 ms
76,784 KB
testcase_07 AC 77 ms
71,348 KB
testcase_08 AC 110 ms
76,780 KB
testcase_09 AC 81 ms
75,952 KB
testcase_10 AC 86 ms
76,632 KB
testcase_11 AC 77 ms
76,236 KB
testcase_12 AC 73 ms
71,520 KB
testcase_13 AC 77 ms
76,128 KB
testcase_14 AC 87 ms
76,696 KB
testcase_15 AC 79 ms
76,280 KB
testcase_16 AC 73 ms
71,380 KB
testcase_17 AC 77 ms
76,024 KB
testcase_18 AC 83 ms
76,384 KB
testcase_19 AC 74 ms
71,160 KB
testcase_20 AC 74 ms
71,392 KB
testcase_21 AC 101 ms
76,656 KB
testcase_22 AC 75 ms
71,484 KB
testcase_23 AC 74 ms
71,552 KB
testcase_24 AC 77 ms
76,012 KB
testcase_25 AC 74 ms
71,372 KB
testcase_26 AC 74 ms
71,636 KB
testcase_27 AC 73 ms
71,228 KB
testcase_28 AC 74 ms
71,584 KB
testcase_29 AC 75 ms
71,372 KB
testcase_30 AC 102 ms
76,504 KB
testcase_31 AC 74 ms
71,512 KB
testcase_32 AC 122 ms
76,676 KB
testcase_33 AC 75 ms
71,364 KB
testcase_34 AC 75 ms
71,644 KB
testcase_35 AC 77 ms
71,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki-1352
from math import gcd
A, B, C = sorted(map(int, input().split()))
b = A//gcd(A, B)
c = A//gcd(A, C)
if gcd(A, gcd(B, C)) > 1:
    print('INF')
    exit()

#mod Aで頑張る
mex = [float('inf')]*A
mex[0] = 0
for i in range(b):
    for j in range(c):
        R = i*B+j*C
        r = R%A
        mex[r] = min(R, mex[r])
ans = [m//A for m in mex]
print(sum(ans))
0