結果

問題 No.25 有限小数
ユーザー aaaaaaaaaa
提出日時 2017-03-02 20:57:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 9,804 KB
最終ジャッジ日時 2023-09-03 20:58:44
合計ジャッジ時間 3,297 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,756 KB
testcase_01 AC 28 ms
9,684 KB
testcase_02 AC 28 ms
9,744 KB
testcase_03 AC 29 ms
9,600 KB
testcase_04 AC 27 ms
9,576 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 29 ms
9,676 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 29 ms
9,712 KB
testcase_12 AC 29 ms
9,736 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 29 ms
9,572 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 28 ms
9,596 KB
testcase_19 AC 28 ms
9,692 KB
testcase_20 AC 28 ms
9,736 KB
testcase_21 AC 29 ms
9,764 KB
testcase_22 AC 28 ms
9,592 KB
testcase_23 AC 29 ms
9,564 KB
testcase_24 AC 29 ms
9,720 KB
testcase_25 AC 29 ms
9,572 KB
testcase_26 AC 29 ms
9,632 KB
testcase_27 AC 28 ms
9,596 KB
testcase_28 AC 28 ms
9,604 KB
testcase_29 AC 29 ms
9,804 KB
testcase_30 AC 29 ms
9,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions
def F(n):
    while n%2==0:n//=2
    while n%5==0:n//=5
    return n == 1
n,m=int(input()),int(input())
if F(fractions.Fraction(n,m).denominator):
    for x in str(format(n/m,'.14f'))[::-1]:
        if x not in['0','.'] :print(x);break
else:print(-1)
0