結果

問題 No.1666 累乗数
ユーザー mkawa2mkawa2
提出日時 2021-09-03 22:26:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,156 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 78,460 KB
最終ジャッジ日時 2023-08-21 22:51:56
合計ジャッジ時間 7,919 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
76,472 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**20
# md = 998244353
md = 10**9+7

pp = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]

def cnt(a):
    res = 1
    for e in pp:
        if 1 << e > a:
            # print(e)
            break
        b = max(2, round(a**(1/e))-3)
        while b**e < a: b += 1
        # print(e, b)
        res += b-2
    return res

def solve():
    k = II()
    if k==1:
        print(1)
        return 
    l, r = 0, 10**18
    while l+1 < r:
        m = (l+r)//2
        if cnt(m) < k: l = m
        else: r = m
    print(l)

for _ in range(II()):
    solve()
0