Problem:


Score : 200 points

Problem Statement

You are given a positive integer X.
Find the largest perfect power that is at most X.
Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Constraints

1 ≤ X ≤ 1000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the largest perfect power that is at most X.

Sample Input 1

10

Sample Output 1

9

There are four perfect powers that are at most 10: 1, 4, 8 and 9.
We should print the largest among them, 9.

Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961



Sample input:
10


Sample output:
9

Submission status: Runtime Error

Solution code:
x = input()
x = int(x)

answer = []
for p in range(2, 10):

    for i in range(1, x):
        if i**p > x:
            answer.append((i-1)**p)
            break
        elif pow(i, p) == x:
            answer.append(i**p)
            break

print(max(answer))

Submission status: Runtime Error

Solution code:
X = int(input())

if X < 4:
  print(1)
  exit(1)

p = 1
b = 2
m = 1
while 1:
  if b ** 2 > X: break
  
  cand = b ** p
  if cand > X:
    b += 1
    p = 1
    continue

  if cand > m:
    m = cand

  p += 1

print(m)

Submission status: Runtime Error

Solution code:
x = input()
max1 = 1
for s in range(x):
  for t in range(x):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Runtime Error

Solution code:
x = map(int, input().split())
max1 = 1
for s in range(x):
  for t in range(x):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Runtime Error

Solution code:
x=int(input())
a=1
while true:
     if(a**2>x):
           print(a-1)
           break
     else:
           a+=1

Submission status: Runtime Error

Solution code:
x = map(int, input().split())
max1 = 1
for s in range(100):
  for t in range(100):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Runtime Error

Solution code:
x = int(input())

#y以上の値は候補とならない
y = int(math.sqrt(x))

k_max = 1
if y >= 2:
    for i in range(2, y + 1):
        j = int(math.log10(x) / math.log10(i))
        k = i ** j
        
        
        if k > k_max:
            k_max = k
    
print(k_max)

Submission status: Runtime Error

Solution code:
X = input()

max = 1
for i in range(1,X):
    for j in range(1,i):
        for k in range(1,j):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)

Submission status: Runtime Error

Solution code:
x = map(int, input().split())
max1 = 1
for s in range(100):
  for t in range(100):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
    


print(max1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

X = int(input())

if X < 4:
  print(1)
  exit(1)

p = 1
b = 2
m = 1
while 1:
  if b ** 2 > X: break
  
  cand = b ** p
  if cand > X:
    b += 1
    p = 1
    continue

  if cand > m:
    m = cand

  p += 1

print(m)

Submission status: Runtime Error

Solution code:
lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
    t=i*i
    lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
a=int(input())
for i in range(300):
    if a < listt[i]:
        print (listt[i-1])
        break
    elif a = listt[i]:
        print(listt[i])
        break

Submission status: Runtime Error

Solution code:
X = input()
X = int(X)
num=0

for i in range(X):
    i = int(i)
    num = i*i 
    if num > X:
        if ans < i:
            ans = i
print(ans)

Submission status: Runtime Error

Solution code:
x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        if (i**j<x):
            beki.append(i**j)
print(max(beki))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) REP(i, 0, (n))
#define REP(i, a, n) for(typeof(n) i=(a); i<(n); i++)

int main() {
	int x; cin >> x;
	int ans = -1;
	REP(b, 1, x+1) {
	    REP(p, 2, 11) {
	        int tmp = pow(b, p);
	        if(tmp > x) break;
	        ans = max(ans, tmp);
	    }
	}
	cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
from math import log
from math import floor
x = int(input())

y = []
for i in range(2,x):
    j = floor(log(x,i))
    if j>1 and i**j <= x:
        y.append(i**j)
print(max(y))

Submission status: Runtime Error

Solution code:
x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        beki.append(i**j)
beki.sort()
for i in range(256):
    if (beki[i] < x):
        ans=beki[i]
    else:
        break
print(ans)

Submission status: Runtime Error

Solution code:

X = int(input())

lim = int(X**(1/2))

listx =[]

for i in range(lim+1):
    if i == 0 or i ==1:
        continue
    a = i
    p = 0
    while a < X:
        a = i ** p
        p += 1
    listx.append(i**(p-2))

print(max(listx))

Submission status: Runtime Error

Solution code:
n = int(input())
result = 0
for b in range(n):
  for p in range(n):
    if b**p => n and result < b**p:
      result = b**p
      break

print(int(result))

Submission status: Runtime Error

Solution code:
x = int(input())

sosu = [2,3,5,7,11,13,17,19,23,29,31]

if(x==1):
  print(1)
else:
  ans = 1
  for i in range(len(sosu)):
    now = sosu[i]
    for j in range(1,11):
      now = now*sosu[i]
      if(now <= x and ans <= now):
        ans = now
      elif(now >= x):
        break

print(ans)

Submission status: Runtime Error

Solution code:
X = int(input())

s = []
for i in range(X+1):
    for j in range(2,X+1):
        if i**j <= X and i**j not in s:
            s.append(i**j)
        if i**j > X:
            break
print(max(s))

Submission status: Runtime Error

Solution code:
x = int(input())
table = [1]
for i in range(2,1000):
	b = 2
	while i**b <= 1000:
		table.append(i**b)
		b += 1
table.sort()
k = 0
while table[k] <= x:
	k += 1
print(table[k-1])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int x;cin>>x;
  int maxn=0;
  for(int i=1;i<=34;i++){
    if(i*i<=x){
      maxn=max(maxn,i*i);
    }
  }
  P(maxn);
  return 0;
}