結果
| 問題 | No.25 有限小数 |
| コンテスト | |
| ユーザー |
aaaaa
|
| 提出日時 | 2017-03-02 21:54:11 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 176 ms / 5,000 ms |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 731 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,836 KB |
| 最終ジャッジ日時 | 2026-03-05 21:03:50 |
| 合計ジャッジ時間 | 6,413 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
import fractions
from decimal import *
def F(n):
while n%2==0:n//=2
while n%5==0:n//=5
return n == 1
getcontext().prec=1000
n,m=Decimal(input()),Decimal(input())
x=str(n/m)
if 'E' in x:x=x[:x.index('E')]
if F(fractions.Fraction(int(n),int(m)).denominator):
for x in x[::-1]:
if x not in['0','.'] :print(x);break
else:print(-1)
aaaaa