結果
| 問題 | No.300 平方数 |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-11-15 13:41:47 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 541 bytes |
| 記録 | |
| コンパイル時間 | 2,219 ms |
| コンパイル使用メモリ | 83,652 KB |
| 実行使用メモリ | 43,620 KB |
| 最終ジャッジ日時 | 2026-04-04 05:58:48 |
| 合計ジャッジ時間 | 5,777 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 34 |
ソースコード
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;
}
System.out.println(ans);
}
}
kou6839