結果

問題 No.1666 累乗数
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-17 19:45:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,011 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,300 KB
最終ジャッジ日時 2023-11-17 19:45:41
合計ジャッジ時間 5,072 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
83,148 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 #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
def floor_sqrt(n,m):
    
    y = n+1
    
    def is_smaller(x):
        if x**m <= n:
            return True
        return False
    
    x = 0
    while y-x>1:
        mid = (y+x)//2
        if is_smaller(mid):
            x = mid
        else:
            y = mid
    return x
def answer():
    
    
    K = int(input())
    
    def is_ok(x):
        
        
        dp = [0]*101
        
        for i in range(100,1,-1):
            
            dp[i] = floor_sqrt(x,i)-1
            for j in range(2*i,101,i):
                dp[i] -= dp[j]
                
            
        # print(x,dp) 
        return sum(dp[2:]) + 1>=K
        
    y = K**2
    x = 0
    while y-x>1:
        mid = (y+x)//2
        if is_ok(mid):
            y = mid
        else:
            x = mid
    print(y)
    # print()
    
    
    
for _ in range(int(input())):
    answer()
0