結果

問題 No.25 有限小数
ユーザー sotanishysotanishy
提出日時 2021-03-18 21:18:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2024-04-28 12:04:18
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,712 KB
testcase_01 AC 32 ms
53,300 KB
testcase_02 AC 33 ms
54,216 KB
testcase_03 AC 36 ms
53,540 KB
testcase_04 AC 36 ms
52,716 KB
testcase_05 AC 34 ms
53,208 KB
testcase_06 AC 33 ms
53,484 KB
testcase_07 AC 34 ms
52,664 KB
testcase_08 AC 34 ms
53,888 KB
testcase_09 AC 33 ms
54,156 KB
testcase_10 AC 31 ms
52,944 KB
testcase_11 AC 31 ms
52,952 KB
testcase_12 AC 35 ms
53,496 KB
testcase_13 AC 34 ms
52,872 KB
testcase_14 AC 33 ms
52,592 KB
testcase_15 AC 36 ms
53,140 KB
testcase_16 AC 34 ms
53,536 KB
testcase_17 AC 34 ms
52,132 KB
testcase_18 AC 34 ms
52,468 KB
testcase_19 AC 33 ms
53,748 KB
testcase_20 AC 33 ms
52,684 KB
testcase_21 AC 34 ms
53,120 KB
testcase_22 AC 34 ms
52,620 KB
testcase_23 AC 34 ms
52,720 KB
testcase_24 AC 34 ms
52,748 KB
testcase_25 AC 34 ms
52,612 KB
testcase_26 AC 34 ms
52,468 KB
testcase_27 AC 33 ms
52,492 KB
testcase_28 AC 34 ms
52,468 KB
testcase_29 AC 36 ms
52,812 KB
testcase_30 AC 32 ms
51,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
import sys
input = sys.stdin.readline

N = int(input())
M = int(input())
g = gcd(N, M)
N //= g
M //= g
while M % 5 == 0:
    M //= 5
    N *= 2
while M % 2 == 0:
    M //= 2
    N *= 5
if M != 1:
    print(-1)
    exit()
while N % 10 == 0:
    N //= 10
print(N % 10)
0