結果

問題 No.1666 累乗数
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-09-03 22:24:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,998 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 82,552 KB
実行使用メモリ 77,688 KB
最終ジャッジ日時 2024-05-09 04:52:16
合計ジャッジ時間 30,532 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
76,856 KB
testcase_01 AC 1,224 ms
77,440 KB
testcase_02 AC 1,269 ms
77,184 KB
testcase_03 AC 1,274 ms
76,788 KB
testcase_04 AC 1,269 ms
77,016 KB
testcase_05 AC 1,998 ms
77,248 KB
testcase_06 AC 1,990 ms
77,480 KB
testcase_07 AC 1,995 ms
77,544 KB
testcase_08 AC 1,983 ms
77,168 KB
testcase_09 AC 1,330 ms
76,672 KB
testcase_10 AC 1,366 ms
76,928 KB
testcase_11 AC 1,372 ms
77,184 KB
testcase_12 AC 1,377 ms
76,672 KB
testcase_13 AC 1,817 ms
77,304 KB
testcase_14 AC 1,814 ms
76,928 KB
testcase_15 AC 1,809 ms
76,928 KB
testcase_16 AC 1,810 ms
77,128 KB
testcase_17 AC 1,498 ms
77,688 KB
testcase_18 AC 1,590 ms
76,920 KB
testcase_19 AC 1,480 ms
77,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline #文字列入力はするな!!
from math import log

def f(x):
    if x==0:return 0
    g=[0]*64
    res=1
    for b in range(2,64):
        a=int(x**(1/b))
        while (a+1)**b<=x:
            a+=1
        while a**b>x:a-=1
        if a>=2:g[b]=a-1
    for b in range(63,1,-1):
        for c in range(b+1,64):
            if c%b==0:
                g[b]-=g[c]
        res+=g[b]
    return res

T=int(input())
for _ in range(T):
    k=int(input())
    ok=10**18+100
    ng=0
    while ok-ng>1:
        mid=(ok+ng)//2
        if f(mid)>=k:ok=mid
        else:ng=mid
    print(ok)




0