結果
問題 |
No.300 平方数
|
ユーザー |
![]() |
提出日時 | 2018-11-03 18:36:40 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 1,858 ms |
コンパイル使用メモリ | 74,572 KB |
実行使用メモリ | 58,516 KB |
最終ジャッジ日時 | 2024-11-20 19:32:28 |
合計ジャッジ時間 | 9,053 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 26 |
ソースコード
import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); long x=scanner.nextLong(); int p[]=prime_fact(x); long ans=1; for(int i=1;i<p.length;i++) { if(p[i]%2==1) { ans*=i; } } System.out.println(ans); } private static int[] prime_fact(long x) { double d = Math.sqrt(x); int res[] = new int[(int) d + 1]; for (int i = 2; i <= d; i++) { while (x % i == 0) { x /= i; res[i]++; } } return res; } }