結果

問題 No.25 有限小数
ユーザー Konton7Konton7
提出日時 2021-01-16 20:04:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 347 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 8,364 KB
最終ジャッジ日時 2023-08-18 18:34:56
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,900 KB
testcase_01 AC 17 ms
8,224 KB
testcase_02 AC 17 ms
8,316 KB
testcase_03 AC 16 ms
7,876 KB
testcase_04 AC 16 ms
7,932 KB
testcase_05 AC 17 ms
7,980 KB
testcase_06 AC 16 ms
7,976 KB
testcase_07 AC 17 ms
8,228 KB
testcase_08 AC 16 ms
8,064 KB
testcase_09 AC 16 ms
7,904 KB
testcase_10 AC 15 ms
7,996 KB
testcase_11 AC 17 ms
8,224 KB
testcase_12 AC 17 ms
7,896 KB
testcase_13 AC 17 ms
7,900 KB
testcase_14 AC 16 ms
7,828 KB
testcase_15 AC 16 ms
8,228 KB
testcase_16 AC 17 ms
7,980 KB
testcase_17 AC 16 ms
7,988 KB
testcase_18 AC 16 ms
7,888 KB
testcase_19 AC 16 ms
8,184 KB
testcase_20 AC 16 ms
8,228 KB
testcase_21 AC 16 ms
8,336 KB
testcase_22 AC 16 ms
7,952 KB
testcase_23 AC 16 ms
7,876 KB
testcase_24 AC 16 ms
7,880 KB
testcase_25 AC 16 ms
8,364 KB
testcase_26 AC 16 ms
8,220 KB
testcase_27 AC 16 ms
8,172 KB
testcase_28 AC 17 ms
8,296 KB
testcase_29 AC 17 ms
8,256 KB
testcase_30 AC 17 ms
8,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

a = int(input())
b = int(input())
c = math.gcd(a, b)

a //= c
b //= c

b2 = b
five = 0
two = 0
while b2 % 5 == 0:
    five += 1
    b2 //= 5
while b2 % 2 == 0:
    two += 1
    b2 //= 2


if b2 != 1:
    print(-1)
    exit(0)

a *= 2**five
a *= 5**two

while True:
    if a % 10 != 0:
        print(a % 10)
        break
    a //= 10
0