結果

問題 No.25 有限小数
ユーザー beet
提出日時 2018-12-02 11:13:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 53,556 KB
最終ジャッジ日時 2024-06-28 13:46:32
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())

x = m
t = 0
f = 0

while x % 2 == 0:
    x = x // 2
    t = t + 1

while x % 5 == 0:
    x = x // 5
    f = f + 1
    
while t < f:
    n *= 2
    m *= 2
    t += 1

while t > f:
    n *= 5
    m *= 5
    f += 1

while n % 10 == 0:
    n = n // 10
    
print(n % 10 if x == 1 else -1)
0