結果

問題 No.300 平方数
ユーザー prime_mgm
提出日時 2016-03-08 15:52:55
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 298 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 74,108 KB
実行使用メモリ 54,360 KB
最終ジャッジ日時 2024-09-24 13:57:47
合計ジャッジ時間 8,987 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		sc.close();

		while(x%4==0) x=x/4;

		for(long i=3; i*i <= x; i += 2){
			while(x%(i*i) == 0) x=x/(i*i);
		}

		System.out.println(x);

	}
}
0