結果

問題 No.1339 循環小数
ユーザー Pretender324
提出日時 2021-01-15 22:30:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 632 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 82,020 KB
実行使用メモリ 77,416 KB
最終ジャッジ日時 2024-11-26 16:22:40
合計ジャッジ時間 8,742 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

# 素因数分解O(√n)


def primeFactor(n):
    res = defaultdict(lambda: 0)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            res[i] += 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res


T = int(input())
for _ in range(T):
    N = int(input())
    while N % 2 == 0:
        N //= 2
    while N % 5 == 0:
        N //= 5
    if N == 1:
        print(1)
    else:
        i = 1
        while True:
            M = int('9' * i)
            if M % N == 0:
                print(i)
                break
            else:
                i += 1
0