結果

問題 No.300 平方数
ユーザー nanophoto12nanophoto12
提出日時 2015-11-15 16:06:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 72,568 KB
実行使用メモリ 60,384 KB
最終ジャッジ日時 2023-10-11 16:24:07
合計ジャッジ時間 8,194 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
59,656 KB
testcase_01 AC 126 ms
55,796 KB
testcase_02 AC 125 ms
55,696 KB
testcase_03 AC 125 ms
55,844 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
55,964 KB
testcase_08 AC 124 ms
55,628 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 127 ms
55,304 KB
testcase_12 WA -
testcase_13 AC 143 ms
55,680 KB
testcase_14 AC 124 ms
55,452 KB
testcase_15 AC 123 ms
55,572 KB
testcase_16 WA -
testcase_17 AC 125 ms
55,884 KB
testcase_18 AC 124 ms
55,744 KB
testcase_19 AC 123 ms
55,680 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package com.company;

import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        HashSet<Integer> hashSet = new HashSet<Integer>();
        for(int i = 2;i*i<=a;i++)
        {
            int count = 0;
            while(a % i == 0)
            {
                a /= i;
                count++;
            }
            if(count % 2 == 1)
            {
                hashSet.add(i);
            }
        }
        long y = 1;
        for(Integer element : hashSet)
        {
            y *= (long)element;
        }
        System.out.println(y);
    }
}
0