結果

問題 No.300 平方数
ユーザー crazybbb3crazybbb3
提出日時 2016-11-28 22:47:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 70 ms / 1,000 ms
コード長 1,844 bytes
コンパイル時間 2,421 ms
コンパイル使用メモリ 73,940 KB
実行使用メモリ 50,528 KB
最終ジャッジ日時 2023-08-18 08:56:23
合計ジャッジ時間 6,299 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,200 KB
testcase_01 AC 43 ms
49,124 KB
testcase_02 AC 43 ms
49,332 KB
testcase_03 AC 43 ms
47,996 KB
testcase_04 AC 43 ms
49,468 KB
testcase_05 AC 42 ms
49,336 KB
testcase_06 AC 44 ms
49,552 KB
testcase_07 AC 42 ms
49,572 KB
testcase_08 AC 45 ms
49,212 KB
testcase_09 AC 43 ms
49,196 KB
testcase_10 AC 43 ms
49,344 KB
testcase_11 AC 42 ms
49,304 KB
testcase_12 AC 61 ms
49,396 KB
testcase_13 AC 61 ms
49,748 KB
testcase_14 AC 41 ms
49,476 KB
testcase_15 AC 42 ms
47,516 KB
testcase_16 AC 54 ms
48,524 KB
testcase_17 AC 42 ms
49,388 KB
testcase_18 AC 42 ms
49,292 KB
testcase_19 AC 42 ms
49,208 KB
testcase_20 AC 46 ms
49,240 KB
testcase_21 AC 54 ms
50,528 KB
testcase_22 AC 48 ms
49,544 KB
testcase_23 AC 49 ms
49,620 KB
testcase_24 AC 51 ms
49,828 KB
testcase_25 AC 59 ms
49,520 KB
testcase_26 AC 54 ms
49,504 KB
testcase_27 AC 49 ms
47,632 KB
testcase_28 AC 58 ms
49,700 KB
testcase_29 AC 59 ms
49,600 KB
testcase_30 AC 59 ms
49,712 KB
testcase_31 AC 46 ms
50,032 KB
testcase_32 AC 58 ms
49,652 KB
testcase_33 AC 53 ms
49,892 KB
testcase_34 AC 58 ms
50,240 KB
testcase_35 AC 56 ms
49,848 KB
testcase_36 AC 57 ms
49,848 KB
testcase_37 AC 56 ms
49,540 KB
testcase_38 AC 44 ms
49,120 KB
testcase_39 AC 57 ms
49,704 KB
testcase_40 AC 58 ms
49,632 KB
testcase_41 AC 54 ms
49,604 KB
testcase_42 AC 49 ms
49,524 KB
testcase_43 AC 51 ms
49,432 KB
testcase_44 AC 70 ms
49,592 KB
testcase_45 AC 54 ms
49,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        long x = nl();

        for (long i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                while (x % (i * i) == 0) {
                    x /= i * i;
                }
            }
        }

        out.println(x);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0