結果
| 問題 |
No.1666 累乗数
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 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 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
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)
taiga0629kyopro