結果

問題 No.1352 Three Coins
ユーザー GER_chenGER_chen
提出日時 2021-01-17 13:17:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 369 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 8,356 KB
最終ジャッジ日時 2023-08-19 22:50:55
合計ジャッジ時間 10,785 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,940 KB
testcase_01 AC 16 ms
8,004 KB
testcase_02 AC 29 ms
7,972 KB
testcase_03 AC 20 ms
7,960 KB
testcase_04 AC 28 ms
7,912 KB
testcase_05 AC 34 ms
7,904 KB
testcase_06 AC 241 ms
8,080 KB
testcase_07 AC 16 ms
8,188 KB
testcase_08 AC 1,371 ms
8,040 KB
testcase_09 AC 48 ms
7,916 KB
testcase_10 AC 348 ms
8,076 KB
testcase_11 AC 18 ms
7,904 KB
testcase_12 AC 16 ms
8,356 KB
testcase_13 AC 25 ms
8,028 KB
testcase_14 AC 398 ms
8,040 KB
testcase_15 AC 21 ms
7,896 KB
testcase_16 AC 16 ms
8,184 KB
testcase_17 AC 32 ms
7,896 KB
testcase_18 AC 204 ms
7,940 KB
testcase_19 AC 16 ms
8,184 KB
testcase_20 AC 16 ms
8,264 KB
testcase_21 AC 1,810 ms
7,972 KB
testcase_22 AC 16 ms
8,316 KB
testcase_23 AC 15 ms
8,188 KB
testcase_24 AC 21 ms
7,920 KB
testcase_25 AC 16 ms
8,268 KB
testcase_26 AC 16 ms
8,344 KB
testcase_27 AC 16 ms
7,904 KB
testcase_28 AC 17 ms
7,904 KB
testcase_29 AC 16 ms
7,960 KB
testcase_30 AC 1,316 ms
8,024 KB
testcase_31 AC 16 ms
7,912 KB
testcase_32 TLE -
testcase_33 AC 16 ms
8,200 KB
testcase_34 AC 16 ms
8,084 KB
testcase_35 AC 16 ms
8,028 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