結果

問題 No.300 平方数
ユーザー kou6839kou6839
提出日時 2015-11-15 13:43:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 560 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 73,136 KB
実行使用メモリ 56,080 KB
最終ジャッジ日時 2023-10-11 16:20:45
合計ジャッジ時間 9,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,472 KB
testcase_01 AC 126 ms
55,452 KB
testcase_02 AC 127 ms
55,940 KB
testcase_03 AC 126 ms
56,048 KB
testcase_04 AC 124 ms
55,616 KB
testcase_05 AC 123 ms
55,952 KB
testcase_06 AC 126 ms
56,048 KB
testcase_07 AC 128 ms
55,720 KB
testcase_08 AC 125 ms
55,452 KB
testcase_09 AC 126 ms
55,860 KB
testcase_10 AC 126 ms
55,796 KB
testcase_11 AC 125 ms
55,636 KB
testcase_12 AC 127 ms
55,792 KB
testcase_13 AC 144 ms
55,860 KB
testcase_14 AC 126 ms
55,960 KB
testcase_15 AC 127 ms
55,628 KB
testcase_16 AC 127 ms
55,668 KB
testcase_17 AC 127 ms
55,904 KB
testcase_18 AC 127 ms
55,848 KB
testcase_19 AC 126 ms
55,460 KB
testcase_20 AC 126 ms
55,456 KB
testcase_21 AC 123 ms
55,652 KB
testcase_22 AC 125 ms
55,632 KB
testcase_23 AC 132 ms
55,704 KB
testcase_24 AC 136 ms
55,904 KB
testcase_25 AC 141 ms
55,896 KB
testcase_26 AC 136 ms
55,900 KB
testcase_27 AC 134 ms
55,824 KB
testcase_28 AC 139 ms
55,592 KB
testcase_29 AC 138 ms
56,068 KB
testcase_30 AC 127 ms
55,676 KB
testcase_31 AC 131 ms
55,712 KB
testcase_32 AC 129 ms
55,696 KB
testcase_33 AC 135 ms
55,632 KB
testcase_34 AC 143 ms
55,864 KB
testcase_35 AC 137 ms
56,008 KB
testcase_36 AC 136 ms
55,744 KB
testcase_37 AC 136 ms
55,696 KB
testcase_38 AC 128 ms
55,724 KB
testcase_39 AC 127 ms
55,896 KB
testcase_40 AC 128 ms
56,080 KB
testcase_41 AC 135 ms
55,692 KB
testcase_42 AC 128 ms
55,664 KB
testcase_43 AC 128 ms
55,932 KB
testcase_44 AC 128 ms
55,980 KB
testcase_45 AC 126 ms
56,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.nio.channels.AsynchronousServerSocketChannel;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		long n = sc.nextLong();
		
		HashMap<Long, Integer> map = new HashMap<>();
		
		for(long i=2;i*i<=n;i++){
			while(n%i==0){
				n/=i;
				if(map.containsKey(i)){
					map.put(i, map.get(i)+1);
				}else{
					map.put(i,1);
				}
			}
		}
		long ans = 1;
		for(long l : map.keySet()){
			if(map.get(l)%2!=0) ans*=l;
		}
		if(n!=1) ans*=n;
		System.out.println(ans);
	}
}
0