結果

問題 No.25 有限小数
ユーザー KudeKude
提出日時 2020-09-04 18:02:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 194 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-08-17 12:22:45
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,632 KB
testcase_01 AC 69 ms
71,412 KB
testcase_02 AC 68 ms
71,372 KB
testcase_03 AC 67 ms
71,484 KB
testcase_04 AC 73 ms
71,480 KB
testcase_05 AC 73 ms
71,480 KB
testcase_06 AC 70 ms
71,552 KB
testcase_07 AC 67 ms
71,504 KB
testcase_08 AC 67 ms
71,444 KB
testcase_09 AC 75 ms
71,424 KB
testcase_10 AC 70 ms
71,328 KB
testcase_11 AC 69 ms
71,380 KB
testcase_12 AC 68 ms
71,416 KB
testcase_13 AC 68 ms
71,412 KB
testcase_14 AC 69 ms
71,424 KB
testcase_15 AC 70 ms
71,504 KB
testcase_16 AC 71 ms
71,484 KB
testcase_17 AC 73 ms
71,404 KB
testcase_18 AC 71 ms
71,552 KB
testcase_19 AC 72 ms
71,292 KB
testcase_20 AC 71 ms
71,624 KB
testcase_21 AC 72 ms
71,412 KB
testcase_22 AC 71 ms
71,488 KB
testcase_23 AC 68 ms
71,420 KB
testcase_24 AC 69 ms
71,148 KB
testcase_25 AC 69 ms
71,480 KB
testcase_26 AC 69 ms
71,624 KB
testcase_27 AC 69 ms
71,200 KB
testcase_28 AC 68 ms
71,504 KB
testcase_29 AC 71 ms
71,484 KB
testcase_30 AC 68 ms
71,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input()) * 10 ** 100
m = int(input())
from math import gcd
d = gcd(n, m)
n //= d
m //= d
if m != 1:
    ans = -1
else:
    while n % 10 == 0:
        n //= 10
    ans = n % 10
print(ans)
0