結果

問題 No.300 平方数
ユーザー samplelpmassamplelpmas
提出日時 2017-04-20 18:47:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 563 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 71,036 KB
実行使用メモリ 57,828 KB
最終ジャッジ日時 2023-09-27 03:48:55
合計ジャッジ時間 9,938 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,940 KB
testcase_01 AC 125 ms
55,768 KB
testcase_02 AC 122 ms
55,788 KB
testcase_03 AC 121 ms
55,568 KB
testcase_04 AC 122 ms
55,576 KB
testcase_05 AC 123 ms
55,652 KB
testcase_06 AC 123 ms
55,660 KB
testcase_07 AC 125 ms
55,532 KB
testcase_08 AC 125 ms
55,876 KB
testcase_09 AC 122 ms
55,956 KB
testcase_10 AC 122 ms
55,732 KB
testcase_11 AC 120 ms
55,660 KB
testcase_12 AC 122 ms
55,924 KB
testcase_13 AC 139 ms
55,788 KB
testcase_14 AC 125 ms
55,616 KB
testcase_15 AC 123 ms
56,084 KB
testcase_16 AC 122 ms
55,644 KB
testcase_17 AC 121 ms
55,572 KB
testcase_18 AC 123 ms
55,552 KB
testcase_19 AC 123 ms
55,860 KB
testcase_20 AC 126 ms
55,884 KB
testcase_21 AC 125 ms
55,672 KB
testcase_22 AC 122 ms
55,576 KB
testcase_23 AC 126 ms
55,892 KB
testcase_24 AC 130 ms
55,580 KB
testcase_25 AC 136 ms
55,788 KB
testcase_26 AC 137 ms
55,732 KB
testcase_27 AC 134 ms
55,740 KB
testcase_28 AC 143 ms
55,656 KB
testcase_29 AC 138 ms
55,612 KB
testcase_30 AC 126 ms
55,784 KB
testcase_31 AC 126 ms
55,612 KB
testcase_32 AC 127 ms
55,928 KB
testcase_33 AC 133 ms
56,144 KB
testcase_34 AC 136 ms
57,828 KB
testcase_35 AC 133 ms
55,504 KB
testcase_36 AC 129 ms
55,776 KB
testcase_37 AC 129 ms
55,792 KB
testcase_38 AC 122 ms
55,892 KB
testcase_39 AC 125 ms
55,596 KB
testcase_40 AC 123 ms
55,592 KB
testcase_41 AC 130 ms
55,936 KB
testcase_42 AC 122 ms
55,732 KB
testcase_43 AC 122 ms
55,428 KB
testcase_44 AC 123 ms
55,580 KB
testcase_45 AC 124 ms
55,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long x = sc.nextLong();

        long y = 1;

        for (long i = 2; (i * i) <= x; i++) {

            int factorCount = 0;

            while (x % i == 0) {

                x /= i;
                factorCount++;

            }

            if (factorCount % 2 != 0) {
                y *= i;
            }

        }

        if (x > 1) {
            y *= x;
        }

        System.out.println(y);

    }

}
0