結果

問題 No.1666 累乗数
ユーザー googol_S0googol_S0
提出日時 2021-09-03 21:40:35
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 999 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 156,948 KB
最終ジャッジ日時 2023-08-21 20:36:17
合計ジャッジ時間 6,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

X=[[] for i in range(62)]
INF=10**18
for i in range(4,62):
  j=1
  while (j**i)<=INF:
    X[i].append(j**i)
    j+=1
for t in range(int(input())):
  K=int(input())
  L,R=0,INF
  while L<R:
    M=(L+R+1)>>1
    S=set()
    for i in range(4,62):
      for j in range(len(X[i])):
        if X[i][j]<=M:
          S.add(X[i][j])
        else:
          break
    A=len(S)
    x=int(M**0.5)
    for i in range(x-2,x+2):
      if i>=0 and (i+1)*(i+1)>M:
        x=i
        break
    A+=x
    S=set()
    for i in range(4,62,2):
      for j in range(len(X[i])):
        if X[i][j]<=M:
          S.add(X[i][j])
        else:
          break
    A-=len(S)
    x=int(M**(1/3))
    for i in range(x-2,x+2):
      if i>=0 and (i+1)*(i+1)*(i+1)>M:
        x=i
        break
    A+=x
    S=set()
    for i in range(6,62,3):
      for j in range(len(X[i])):
        if X[i][j]<=M:
          S.add(X[i][j])
        else:
          break
    A-=len(S)
    if A<K:
      L=M
    else:
      R=min(R-1,M)
  print(L+1)
0