結果

問題 No.1666 累乗数
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-09-03 22:29:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,077 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 82,632 KB
実行使用メモリ 77,512 KB
最終ジャッジ日時 2024-12-15 14:51:59
合計ジャッジ時間 15,917 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,748 KB
testcase_01 AC 435 ms
77,512 KB
testcase_02 AC 442 ms
77,016 KB
testcase_03 AC 432 ms
76,912 KB
testcase_04 AC 462 ms
76,928 KB
testcase_05 AC 1,077 ms
76,844 KB
testcase_06 AC 1,045 ms
77,272 KB
testcase_07 AC 1,059 ms
76,976 KB
testcase_08 AC 1,051 ms
77,024 KB
testcase_09 AC 500 ms
76,892 KB
testcase_10 AC 514 ms
77,312 KB
testcase_11 AC 532 ms
77,056 KB
testcase_12 AC 531 ms
76,808 KB
testcase_13 AC 906 ms
76,884 KB
testcase_14 AC 907 ms
77,092 KB
testcase_15 AC 904 ms
76,968 KB
testcase_16 AC 991 ms
76,984 KB
testcase_17 AC 616 ms
77,396 KB
testcase_18 AC 706 ms
76,812 KB
testcase_19 AC 657 ms
77,168 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