結果

問題 No.300 平方数
ユーザー nanophoto12nanophoto12
提出日時 2015-11-15 16:32:41
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 793 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 72,828 KB
実行使用メモリ 60,088 KB
最終ジャッジ日時 2023-10-11 16:25:05
合計ジャッジ時間 8,140 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
60,088 KB
testcase_01 AC 128 ms
56,176 KB
testcase_02 AC 127 ms
55,572 KB
testcase_03 AC 127 ms
55,892 KB
testcase_04 AC 125 ms
55,804 KB
testcase_05 AC 126 ms
55,576 KB
testcase_06 AC 126 ms
55,852 KB
testcase_07 AC 127 ms
57,832 KB
testcase_08 AC 128 ms
55,676 KB
testcase_09 AC 125 ms
55,912 KB
testcase_10 AC 126 ms
55,692 KB
testcase_11 AC 125 ms
55,568 KB
testcase_12 AC 124 ms
55,792 KB
testcase_13 AC 144 ms
55,896 KB
testcase_14 AC 127 ms
55,620 KB
testcase_15 AC 126 ms
55,764 KB
testcase_16 AC 127 ms
55,612 KB
testcase_17 AC 126 ms
55,944 KB
testcase_18 AC 125 ms
55,388 KB
testcase_19 AC 125 ms
55,944 KB
testcase_20 AC 126 ms
55,536 KB
testcase_21 AC 128 ms
55,772 KB
testcase_22 AC 125 ms
55,420 KB
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 n = scanner.nextLong();
        long a = n;
        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;
        }
        if(a != 1)
        {
            y*=a;
        }
        System.out.println(y);
    }
}
0