結果

問題 No.1339 循環小数
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-15 22:29:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 962 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 319,300 KB
最終ジャッジ日時 2024-05-05 00:32:49
合計ジャッジ時間 24,999 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 TLE -
testcase_23 WA -
testcase_24 WA -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 WA -
testcase_28 TLE -
testcase_29 WA -
testcase_30 TLE -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 TLE -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(3*10**5)
t = int(input())
b = {}
for _ in range(t):
    n = int(input())
    dic = {}
    now = 1
    p = n
    for i in range(2,int(p**0.5)+1):
        if n == 1 or i > n:
            break
        while n%i == 0:
            n //= i
    if n == 1:
        print(1)
        continue
    if n in b:
        print(b[n])
        continue

    while now < n:
        now *= 10
    c = 0
    ans = 1
    print(now,n)
    while now:
        x,now = divmod(now,n)
        if now in dic:
            ans = c-dic[now]
            break
        dic[now] = c
        now *= 10
        c += 1
        if c >= 2*10**5:
            ans = p-1
            break
    b[n] = ans
    print(ans)

0