結果
問題 | No.300 平方数 |
ユーザー |
![]() |
提出日時 | 2017-09-20 00:44:24 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 4,075 ms |
コンパイル使用メモリ | 76,708 KB |
実行使用メモリ | 42,824 KB |
最終ジャッジ日時 | 2024-11-08 05:50:08 |
合計ジャッジ時間 | 13,508 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 7 WA * 36 |
ソースコード
import java.util.Scanner;public class N300{public static void main(String[] args){Scanner sc = new Scanner(System.in);long x=sc.nextLong();long ans=1;while(x!=1){int br=0;for(int i=2;i<=(int)Math.sqrt(x);i++){if(x%i==0){ans=(ans%i==0)?ans/i:ans*i;x/=i;System.out.println(x+" "+i);br++;break;}}if(br==0){ans=(ans%x==0)?ans/x:ans*x;break;}}System.out.println(ans);}}