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

Solution in C (GCC 5.4.1) (judge verdict: Accepted)

#include<stdio.h>

int main(){
  int a;
  scanf("%d",&a);
  if(a<=3){
    puts("1");
    return 0;
  }if(a<=7){
    puts("4");
    return 0;
  }if(a<=8){
    puts("8");
    return 0;
  }if(a<=15){
    puts("9");
    return 0;
  }if(a<=24){
    puts("16");
    return 0;
  }if(a<=26){
    puts("25");
    return 0;
  }if(a<=31){
    puts("27");
    return 0;
  }if(a<=35){
    puts("32");
    return 0;
  }if(a<=48){
    puts("36");
    return 0;
  }if(a<=63){
    puts("49");
    return 0;
  }if(a<=80){
    puts("64");
    return 0;
  }if(a<=99){
    puts("81");
    return 0;
  }if(a<=120){
    puts("100");
    return 0;
  }if(a<=124){
    puts("121");
    return 0;
  }if(a<=127){
    puts("125");
    return 0;
  }if(a<=143){
    puts("128");
    return 0;
  }if(a<=168){
    puts("144");
    return 0;
  }if(a<=195){
    puts("169");
    return 0;
  }if(a<=215){
    puts("196");
    return 0;
  }if(a<=224){
    puts("216");
    return 0;
  }if(a<=242){
    puts("225");
    return 0;
  }if(a<=255){
    puts("243");
    return 0;
  }if(a<=288){
    puts("256");
    return 0;
  }if(a<=323){
    puts("289");
    return 0;
  }if(a<=342){
    puts("324");
    return 0;
  }if(a<=360){
    puts("343");
    return 0;
  }if(a<=399){
    puts("361");
    return 0;
  }if(a<=440){
    puts("400");
    return 0;
  }if(a<=483){
    puts("441");
    return 0;
  }if(a<=511){
    puts("484");
    return 0;
  }if(a<=528){
    puts("512");
    return 0;
  }if(a<=575){
    puts("529");
    return 0;
  }if(a<=624){
    puts("576");
    return 0;
  }if(a<=675){
    puts("625");
    return 0;
  }if(a<=728){
    puts("676");
    return 0;
  }if(a<=783){
    puts("729");
    return 0;
  }if(a<=840){
    puts("784");
    return 0;
  }if(a<=899){
    puts("841");
    return 0;
  }if(a<=960){
    puts("900");
    return 0;
  }if(a<=999){
    puts("961");
    return 0;
  }
  puts("1000");
  return 0;
}