結果

問題 No.1666 累乗数
ユーザー mkawa2mkawa2
提出日時 2021-09-03 22:55:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,434 ms / 2,000 ms
コード長 1,258 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 78,804 KB
最終ジャッジ日時 2023-08-22 00:12:19
合計ジャッジ時間 19,622 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
77,932 KB
testcase_01 AC 488 ms
78,224 KB
testcase_02 AC 492 ms
78,632 KB
testcase_03 AC 497 ms
78,140 KB
testcase_04 AC 503 ms
78,428 KB
testcase_05 AC 1,429 ms
78,480 KB
testcase_06 AC 1,434 ms
78,728 KB
testcase_07 AC 1,428 ms
78,800 KB
testcase_08 AC 1,427 ms
78,456 KB
testcase_09 AC 658 ms
78,308 KB
testcase_10 AC 676 ms
78,412 KB
testcase_11 AC 668 ms
78,360 KB
testcase_12 AC 666 ms
78,368 KB
testcase_13 AC 1,234 ms
78,544 KB
testcase_14 AC 1,262 ms
78,396 KB
testcase_15 AC 1,250 ms
78,804 KB
testcase_16 AC 1,228 ms
78,140 KB
testcase_17 AC 842 ms
78,504 KB
testcase_18 AC 989 ms
78,668 KB
testcase_19 AC 844 ms
78,680 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    dp=[0]*63
    for e in range(2,63):
        if (1 << e) > a:
            # print(e)
            continue
        b = max(2, round(a**(1/e))-3)
        while b**e <= a: b += 1
        # print(e, b)
        dp[e]= b-2
    for e in range(2,63)[::-1]:
        for i in range(e+e,63,e):
            dp[e]-=dp[i]
    # print(a,dp)
    return sum(dp)+1

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

# print(cnt(9))
for _ in range(II()):
    solve()
0