結果

問題 No.25 有限小数
ユーザー 👑 colognecologne
提出日時 2022-01-23 01:56:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 342 bytes
コンパイル時間 1,544 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 71,660 KB
最終ジャッジ日時 2023-08-19 02:07:33
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,364 KB
testcase_01 AC 58 ms
71,332 KB
testcase_02 AC 59 ms
71,300 KB
testcase_03 AC 62 ms
71,484 KB
testcase_04 AC 57 ms
71,520 KB
testcase_05 AC 58 ms
71,600 KB
testcase_06 AC 58 ms
71,564 KB
testcase_07 AC 57 ms
71,404 KB
testcase_08 AC 58 ms
71,584 KB
testcase_09 AC 58 ms
71,588 KB
testcase_10 AC 58 ms
71,520 KB
testcase_11 AC 58 ms
71,576 KB
testcase_12 AC 60 ms
71,152 KB
testcase_13 AC 59 ms
71,280 KB
testcase_14 AC 59 ms
71,660 KB
testcase_15 AC 59 ms
71,440 KB
testcase_16 AC 60 ms
71,456 KB
testcase_17 AC 59 ms
71,452 KB
testcase_18 AC 59 ms
71,256 KB
testcase_19 AC 59 ms
71,160 KB
testcase_20 AC 61 ms
71,436 KB
testcase_21 AC 59 ms
71,532 KB
testcase_22 AC 58 ms
71,496 KB
testcase_23 AC 59 ms
71,116 KB
testcase_24 AC 61 ms
71,592 KB
testcase_25 AC 59 ms
71,404 KB
testcase_26 AC 60 ms
71,492 KB
testcase_27 AC 60 ms
71,164 KB
testcase_28 AC 60 ms
71,372 KB
testcase_29 AC 61 ms
71,540 KB
testcase_30 AC 59 ms
71,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

input = sys.stdin.readline


def main():
    N = int(input())
    M = int(input())
    M *= 10**50
    for i in range(200):
        g = math.gcd(N, M)
        N //= g
        M //= g
        if M == 1:
            print(N % 10)
            return
        N *= 10

    print(-1)


if __name__ == '__main__':
    main()
0