結果
| 問題 | No.25 有限小数 |
| コンテスト | |
| ユーザー |
sotanishy
|
| 提出日時 | 2021-03-18 21:18:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 287 bytes |
| 記録 | |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 85,528 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2026-05-12 05:27:33 |
| 合計ジャッジ時間 | 2,352 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
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)
sotanishy