結果

問題 No.1339 循環小数
ユーザー maninimanini
提出日時 2021-01-26 10:28:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 562 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 498,840 KB
最終ジャッジ日時 2023-09-05 13:47:07
合計ジャッジ時間 7,908 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,780 KB
testcase_01 AC 84 ms
76,176 KB
testcase_02 AC 80 ms
76,144 KB
testcase_03 AC 82 ms
76,200 KB
testcase_04 AC 86 ms
76,208 KB
testcase_05 AC 83 ms
76,200 KB
testcase_06 AC 83 ms
76,528 KB
testcase_07 AC 84 ms
76,328 KB
testcase_08 AC 85 ms
76,260 KB
testcase_09 AC 81 ms
76,148 KB
testcase_10 AC 80 ms
76,268 KB
testcase_11 AC 187 ms
84,724 KB
testcase_12 AC 202 ms
91,936 KB
testcase_13 AC 163 ms
83,408 KB
testcase_14 AC 186 ms
91,500 KB
testcase_15 AC 177 ms
83,816 KB
testcase_16 AC 163 ms
85,280 KB
testcase_17 AC 202 ms
89,820 KB
testcase_18 AC 157 ms
82,928 KB
testcase_19 AC 158 ms
83,472 KB
testcase_20 AC 148 ms
79,936 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:UTF-8
import sys

MOD = 10 ** 9 + 7
INF = float('inf')

T = int(input())    # 数字

res = []
for i in range(T):
    N = int(input())    # 数字

    mp = {}
    r = 0
    idx = 1
    am = 9
    while True:
        d, m = divmod(am, N)
        if d in mp:
            if m in mp[d]:
                r = idx - mp[d][m]
                break
            else:
                mp[d][m] = idx
        else:
            mp[d] = {}
            mp[d][m] = idx

        am = 10 * m + 9
        idx += 1

    res.append(r)

for i in range(T):
    print(res[i])
0