Submission #2495640


Source Code Expand

Copy
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int x;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        x = sc.nextInt();
        solve();
    }

    void solve() {
        int sqrtX = (int)Math.sqrt(x);
        int ans = 1;
        for (int i = 2; i <= sqrtX; i++) {
            int temp = i;
            while (temp < x) {
                temp *= i;
            }
            temp /= i;
            if (ans < temp) {
                ans = temp;
            }
        }
        System.out.println(ans);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Submission Info

Submission Time
Task B - Exponential
User ynish
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1954 Byte
Status WA
Exec Time 92 ms
Memory 21076 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 7
WA × 2
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 68 ms 21076 KB
0_001.txt AC 92 ms 18644 KB
0_002.txt AC 69 ms 20564 KB
1_003.txt AC 71 ms 18644 KB
1_004.txt AC 68 ms 19284 KB
1_005.txt AC 70 ms 19156 KB
1_006.txt WA 68 ms 18260 KB
1_007.txt WA 69 ms 19028 KB
1_008.txt AC 67 ms 17748 KB