結果
| 問題 | No.300 平方数 |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-11-15 13:41:47 |
| 言語 | Java (openjdk 25.0.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 541 bytes |
| 記録 | |
| コンパイル時間 | 2,188 ms |
| コンパイル使用メモリ | 76,416 KB |
| 実行使用メモリ | 56,160 KB |
| 最終ジャッジ日時 | 2024-09-13 15:01:22 |
| 合計ジャッジ時間 | 10,033 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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