結果

問題 No.25 有限小数
ユーザー maspy
提出日時 2020-01-01 13:41:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 340 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-22 01:57:26
合計ジャッジ時間 2,647 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from fractions import gcd

a,b = map(int,read().split())

g = gcd(a,b); a //= g; b //= g

d = 10 ** 100
if d % b != 0:
    print(-1)
    exit()

x = a * d // b

while x % 10 == 0:
    x //= 10

answer = x % 10
print(answer)
0