結果

問題 No.25 有限小数
ユーザー ntuda
提出日時 2024-12-24 00:10:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 310 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-12-24 00:10:11
合計ジャッジ時間 3,086 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())
X2 = 0
M2 = M
while M2 % 2 == 0:
    M2 //= 2
    N *= 5
while M2 % 5 == 0:
    M2 //= 5
    N *= 2
if M2 != 1:
    if N % M2 == 0:
        N //= M2
    else:
        print(-1)
        exit()
S = str(N)
for s in reversed(S):
    if s != "0":
        print(s)
        exit()


0