結果

問題 No.1666 累乗数
ユーザー 👑 rin204rin204
提出日時 2023-12-20 22:47:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 658 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,672 KB
最終ジャッジ日時 2023-12-20 22:47:42
合計ジャッジ時間 37,116 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
76,012 KB
testcase_01 AC 1,371 ms
77,036 KB
testcase_02 AC 1,433 ms
76,696 KB
testcase_03 AC 1,423 ms
76,696 KB
testcase_04 AC 1,457 ms
76,696 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 1,627 ms
76,668 KB
testcase_10 AC 1,674 ms
77,032 KB
testcase_11 AC 1,685 ms
76,784 KB
testcase_12 AC 1,669 ms
76,684 KB
testcase_13 TLE -
testcase_14 AC 1,882 ms
76,760 KB
testcase_15 AC 1,860 ms
76,884 KB
testcase_16 AC 1,887 ms
76,888 KB
testcase_17 AC 1,543 ms
76,628 KB
testcase_18 TLE -
testcase_19 AC 1,902 ms
76,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = 60

for _ in range(int(input())):
    k = int(input())
    if k == 1:
        print(1)
        continue

    k -= 1
    l = 1
    r = 10**18
    while r - l > 1:
        cnt = 0
        m = (l + r) // 2
        C = [0] * (M + 1)
        for i in range(M, 1, -1):
            c = int(m ** (1 / i))
            while c**i <= m:
                c += 1
            while c**i > m:
                c -= 1
            c -= 1
            C[i] = c
            for j in range(i + 1, M + 1):
                if j % i == 0:
                    C[i] -= C[j]
            cnt += C[i]
        if cnt >= k:
            r = m
        else:
            l = m
    print(r)
0