結果
問題 | No.25 有限小数 |
ユーザー |
![]() |
提出日時 | 2021-03-18 21:18:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 287 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-11-17 03:27:05 |
合計ジャッジ時間 | 2,764 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)