結果

問題 No.1666 累乗数
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-09-03 22:29:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,315 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 79,160 KB
最終ジャッジ日時 2023-08-21 23:12:06
合計ジャッジ時間 18,690 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
77,720 KB
testcase_01 AC 577 ms
78,340 KB
testcase_02 AC 568 ms
78,888 KB
testcase_03 AC 565 ms
78,596 KB
testcase_04 AC 566 ms
78,772 KB
testcase_05 AC 1,296 ms
78,708 KB
testcase_06 AC 1,311 ms
78,584 KB
testcase_07 AC 1,315 ms
78,480 KB
testcase_08 AC 1,291 ms
78,756 KB
testcase_09 AC 658 ms
78,620 KB
testcase_10 AC 659 ms
78,752 KB
testcase_11 AC 666 ms
78,756 KB
testcase_12 AC 686 ms
78,508 KB
testcase_13 AC 1,120 ms
78,460 KB
testcase_14 AC 1,142 ms
78,612 KB
testcase_15 AC 1,124 ms
78,656 KB
testcase_16 AC 1,120 ms
79,160 KB
testcase_17 AC 785 ms
78,516 KB
testcase_18 AC 894 ms
78,672 KB
testcase_19 AC 818 ms
78,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

g=[0]*62
def f(x):
    if x==0:return 0
    res=1
    for b in range(2,62):
        g[b]=0
        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(61,1,-1):
        i=2
        while i*b<=61:
            c=i*b
            if c%b==0:
                g[b]-=g[c]
            i+=1
        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