結果

問題 No.1666 累乗数
ユーザー tassei903tassei903
提出日時 2021-09-03 22:51:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,138 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 82,176 KB
最終ジャッジ日時 2024-05-09 06:00:14
合計ジャッジ時間 5,433 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 936 ms
81,408 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
p = []
MAX = 63
arr = [-1] * (MAX + 1)
for i in range(2, int(MAX**0.5)+1):
    if arr[i]!=-1:
        continue
    j = 1
    p.append(i)
    while i * j < len(arr):
        if arr[i * j] < 0:
            arr[i * j] = i
        j += 1
for i in range(2, len(arr)):
    if arr[i]==-1:
        p.append(i)

def g(x,n):
    ng = 2*10**18
    ok = 0
    while ng-ok>1:
        d = (ok+ng)//2
        if d**x<=n:
            ok = d
        else:
            ng = d
    return ok

def f(x):
    r = 1
    for q in p:
        r+=g(q,x)-1
    #print(x,r)
    return r>=K


T = ni()
for i in range(T):
    K = ni()
    ok = 10**18
    ng = 0
    while ok-ng>1:
        d = (ok+ng)//2
        if f(d):
            ok = d
        else:
            ng = d
    print(ok)
0