結果

問題 No.1339 循環小数
ユーザー aaaaaaaaaa2230
提出日時 2021-01-15 22:07:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 640,192 KB
最終ジャッジ日時 2024-11-26 15:00:47
合計ジャッジ時間 50,369 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 TLE * 15 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(3*10**5)
t = int(input())
for _ in range(t):
    n = int(input())
    dic = {}
    now = 1
    while now < n:
        now *= 10
    c = 0
    ans = 1
    while now:
        x,now = divmod(now,n)
        if now in dic:
            ans = c-dic[now]
            break
        dic[now] = c
        if c >= 2*10**5:
            ans = n-1
            break
        now *= 10
        #print(now)
        c += 1
    print(ans)
0