結果

問題 No.300 平方数
ユーザー scachescache
提出日時 2015-11-13 22:28:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 1,000 ms
コード長 617 bytes
コンパイル時間 3,410 ms
コンパイル使用メモリ 73,304 KB
実行使用メモリ 57,916 KB
最終ジャッジ日時 2023-10-11 15:53:59
合計ジャッジ時間 12,743 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
55,796 KB
testcase_01 AC 167 ms
55,792 KB
testcase_02 AC 167 ms
55,984 KB
testcase_03 AC 168 ms
55,840 KB
testcase_04 AC 166 ms
55,964 KB
testcase_05 AC 166 ms
55,988 KB
testcase_06 AC 166 ms
55,972 KB
testcase_07 AC 173 ms
55,880 KB
testcase_08 AC 170 ms
55,664 KB
testcase_09 AC 167 ms
55,636 KB
testcase_10 AC 167 ms
55,652 KB
testcase_11 AC 172 ms
55,876 KB
testcase_12 AC 166 ms
55,840 KB
testcase_13 AC 168 ms
55,804 KB
testcase_14 AC 170 ms
55,520 KB
testcase_15 AC 167 ms
56,168 KB
testcase_16 AC 164 ms
55,900 KB
testcase_17 AC 164 ms
55,968 KB
testcase_18 AC 165 ms
55,644 KB
testcase_19 AC 167 ms
57,916 KB
testcase_20 AC 167 ms
55,472 KB
testcase_21 AC 165 ms
55,984 KB
testcase_22 AC 166 ms
55,756 KB
testcase_23 AC 166 ms
56,212 KB
testcase_24 AC 166 ms
55,956 KB
testcase_25 AC 166 ms
55,936 KB
testcase_26 AC 166 ms
55,556 KB
testcase_27 AC 166 ms
55,652 KB
testcase_28 AC 165 ms
56,120 KB
testcase_29 AC 168 ms
56,084 KB
testcase_30 AC 167 ms
55,608 KB
testcase_31 AC 168 ms
55,936 KB
testcase_32 AC 167 ms
55,788 KB
testcase_33 AC 169 ms
55,756 KB
testcase_34 AC 170 ms
55,460 KB
testcase_35 AC 168 ms
55,540 KB
testcase_36 AC 167 ms
55,908 KB
testcase_37 AC 167 ms
55,904 KB
testcase_38 AC 166 ms
54,180 KB
testcase_39 AC 168 ms
55,996 KB
testcase_40 AC 168 ms
56,012 KB
testcase_41 AC 167 ms
55,952 KB
testcase_42 AC 168 ms
55,416 KB
testcase_43 AC 169 ms
55,884 KB
testcase_44 AC 166 ms
55,836 KB
testcase_45 AC 168 ms
56,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class Main299 {
    public static void main(String[] args) {
        new Main299();
    }

    public Main299() {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        System.out.println(solve(x));
    }

    public long solve(long x) {
        long res = 1;
        for (long i = 2; i * i < (10e+12) + 1; i++) {
            int count = 0;
            while (x % i == 0) {
                x /= i;
                count++;
            }

            res *= count % 2 == 1 ? i : 1;
        }

        return res * x;

    }
}
0