結果

問題 No.1339 循環小数
ユーザー 👑 terry_u16terry_u16
提出日時 2021-01-15 23:01:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 227,644 KB
最終ジャッジ日時 2024-05-05 01:00:19
合計ジャッジ時間 25,776 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
117,504 KB
testcase_01 AC 659 ms
224,524 KB
testcase_02 AC 668 ms
224,560 KB
testcase_03 AC 749 ms
224,664 KB
testcase_04 AC 592 ms
225,324 KB
testcase_05 AC 654 ms
225,256 KB
testcase_06 AC 588 ms
225,428 KB
testcase_07 AC 583 ms
225,316 KB
testcase_08 AC 684 ms
224,816 KB
testcase_09 AC 666 ms
225,088 KB
testcase_10 AC 671 ms
224,920 KB
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 AC 646 ms
224,672 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

tests = int(input())

for _ in range(tests):
    result = []
    mods = []
    n = int(input())
    mod = 1
    for _ in range(100000):
        nxt = mod // n
        mod -= n * nxt
        result.append(nxt)
        mods.append(mod)
        mod *= 10
    
    for length in range(1, 50001):
        ok = True
        for i in range(1, length + 1):
            ok &= result[-i] == result[-(i + length)]
            ok &= mods[-i] == mods[-(i + length)]
            if not ok:
                break

        if ok:
            print(length)
            break   
0