結果

問題 No.1666 累乗数
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-09-03 21:51:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 580 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,784 KB
実行使用メモリ 83,916 KB
最終ジャッジ日時 2024-05-09 03:24:36
合計ジャッジ時間 3,834 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
81,792 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=sys.stdin.readline #文字列入力はするな!!
from math import log

def f(x):
    if x==0:return 0
    res=1
    for b in range(2,64):
        ok=0
        ng=log(10**18)/log(b)
        ng+=10
        ng=int(ng)
        while ng-ok>1:
            mid=(ok+ng)//2
            if mid**b<=x:ok=mid
            else:ng=mid
        res+=ok-1
    if x>=16:res-=1
    return res

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