結果
問題 | No.25 有限小数 |
ユーザー |
![]() |
提出日時 | 2020-03-13 15:33:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 383 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-11-22 05:19:00 |
合計ジャッジ時間 | 2,778 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 31 |
ソースコード
#!/usr/bin/env python3 import sys input = sys.stdin.readline from fractions import gcd n = int(input()) m = int(input()) base = m // gcd(n, m) while base % 2 == 0: base //= 2 while base % 5 == 0: base //= 5 if base == 1: s = str(n / m) if "e" in s: index = s.find("e") - 1 else: index = len(s) - 1 while s[index] in ".0": index -= 1 print(s[index]) else: print(-1)