結果
| 問題 | No.1666 累乗数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-03 22:58:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,270 bytes |
| 記録 | |
| コンパイル時間 | 316 ms |
| コンパイル使用メモリ | 82,488 KB |
| 実行使用メモリ | 77,656 KB |
| 最終ジャッジ日時 | 2024-12-15 16:37:34 |
| 合計ジャッジ時間 | 4,988 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 19 |
ソースコード
import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
p = []
MAX = 63
arr = [-1] * (MAX + 1)
for i in range(2, int(MAX**0.5)+1):
if arr[i]!=-1:
continue
j = 1
p.append(i)
while i * j < len(arr):
if arr[i * j] < 0:
arr[i * j] = i
j += 1
for i in range(2, len(arr)):
if arr[i]==-1:
p.append(i)
def g(x,n):
ng = 10**9
ok = 0
while ng-ok>1:
d = (ok+ng)//2
if d**x<=n:
ok = d
else:
ng = d
return ok
def g(x,n):
c = int(n**(1/x))-1
return max([i for i in range(c,c+2) if pow(i,x)<=n])
def f(x):
r = 1
for q in p:
if pow(2,q)>x:
break
r+=g(q,x)-1
#print(x,r)
return r>=K
T = ni()
for i in range(T):
K = ni()
ok = 10**18
ng = 0
while ok-ng>1:
d = (ok+ng)//2
if f(d):
ok = d
else:
ng = d
print(ok)