結果

問題 No.300 平方数
ユーザー ottfoekst
提出日時 2015-11-14 23:45:16
言語 Java
(openjdk 23)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 504 bytes
コンパイル時間 3,394 ms
コンパイル使用メモリ 74,180 KB
実行使用メモリ 41,780 KB
最終ジャッジ日時 2024-09-13 16:46:30
合計ジャッジ時間 10,932 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No300 {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long input = scanner.nextLong();
		System.out.println(getAnswerNum(input));
		scanner.close();
	}

	private static long getAnswerNum(long input) {
		long index = 2;
		while(true) {
			long squareIndex = index * index;
			if(input < squareIndex) {
				break;
			}
			while(input % squareIndex == 0) {
				input /= squareIndex;
			}
			index++;
		}
		return input;
	}
}
0