結果

問題 No.300 平方数
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 22:55:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 612 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 71,192 KB
実行使用メモリ 56,124 KB
最終ジャッジ日時 2023-08-17 07:43:07
合計ジャッジ時間 9,794 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,456 KB
testcase_01 AC 127 ms
55,860 KB
testcase_02 AC 135 ms
55,676 KB
testcase_03 AC 123 ms
55,836 KB
testcase_04 AC 124 ms
55,980 KB
testcase_05 AC 127 ms
55,648 KB
testcase_06 AC 124 ms
55,876 KB
testcase_07 AC 124 ms
55,824 KB
testcase_08 AC 126 ms
55,788 KB
testcase_09 AC 124 ms
55,868 KB
testcase_10 AC 124 ms
55,824 KB
testcase_11 AC 126 ms
56,024 KB
testcase_12 AC 126 ms
53,672 KB
testcase_13 AC 137 ms
55,872 KB
testcase_14 AC 125 ms
55,400 KB
testcase_15 AC 132 ms
55,728 KB
testcase_16 AC 133 ms
55,712 KB
testcase_17 AC 126 ms
55,456 KB
testcase_18 AC 130 ms
55,908 KB
testcase_19 AC 133 ms
55,848 KB
testcase_20 AC 131 ms
55,812 KB
testcase_21 AC 138 ms
56,036 KB
testcase_22 AC 136 ms
55,860 KB
testcase_23 AC 130 ms
55,908 KB
testcase_24 AC 131 ms
55,940 KB
testcase_25 AC 133 ms
55,512 KB
testcase_26 AC 133 ms
55,856 KB
testcase_27 AC 134 ms
54,324 KB
testcase_28 AC 135 ms
56,124 KB
testcase_29 AC 135 ms
55,832 KB
testcase_30 AC 135 ms
55,664 KB
testcase_31 AC 135 ms
55,748 KB
testcase_32 AC 134 ms
55,720 KB
testcase_33 AC 131 ms
55,816 KB
testcase_34 AC 138 ms
55,964 KB
testcase_35 AC 136 ms
55,412 KB
testcase_36 AC 133 ms
55,644 KB
testcase_37 AC 134 ms
55,688 KB
testcase_38 AC 133 ms
55,524 KB
testcase_39 AC 134 ms
53,912 KB
testcase_40 AC 133 ms
55,688 KB
testcase_41 AC 135 ms
55,844 KB
testcase_42 AC 134 ms
55,720 KB
testcase_43 AC 129 ms
56,032 KB
testcase_44 AC 134 ms
55,760 KB
testcase_45 AC 134 ms
55,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        long Y = 1L;
        int c=0;
        while(X%2==0){
            X/=2;
            c++;
        }
        if(c%2==1){
            Y*=2;
        }
        long A = (long)Math.sqrt(X);
        for(long i=3; i<=A; i+=2){
            c=0;
            while(X%i==0){
                X/=i;
                c++;
            }
            if(c%2==1){
                Y*=i;
            }
        }
        Y*=X;
        System.out.println(Y);
    }
}
0