結果

問題 No.1666 累乗数
ユーザー siro53siro53
提出日時 2021-09-04 00:04:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 77,400 KB
最終ジャッジ日時 2024-05-09 08:27:04
合計ジャッジ時間 12,041 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
76,288 KB
testcase_01 AC 592 ms
76,820 KB
testcase_02 AC 588 ms
76,592 KB
testcase_03 AC 589 ms
76,612 KB
testcase_04 AC 579 ms
76,624 KB
testcase_05 AC 530 ms
76,648 KB
testcase_06 AC 530 ms
76,908 KB
testcase_07 AC 529 ms
77,164 KB
testcase_08 AC 530 ms
76,928 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import sqrt
input = sys.stdin.readline

def f(N):
    cnt = [0] * 60
    for i in range(2, 60)[::-1]:
        ok = 0
        ng = int((10**18 + 100000)**(1/i))
        while ng - ok > 1:
            mid = (ok + ng) // 2
            if mid ** i <= N:
                ok = mid
            else:
                ng = mid
        ok -= 1
        cnt[i] = ok - sum(cnt[::i])
    return sum(cnt) + 1

# print(f(10))

def main():
    K = int(input())
    ok, ng = 10**18, 0 
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if f(mid) >= K:
            ok = mid
        else:
            ng = mid
    print(ok)

if __name__ == '__main__':
    T = int(input())
    for _ in range(T):
        main()
0