結果

問題 No.300 平方数
ユーザー Grenache
提出日時 2015-11-13 22:27:43
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 1,000 ms
コード長 497 bytes
コンパイル時間 3,585 ms
コンパイル使用メモリ 75,152 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2024-09-13 14:39:21
合計ジャッジ時間 11,170 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder300 {

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

        long x = sc.nextLong();

        long ret = 1;
        for (long i = 2; i * i <= x; i++) {
        	int tmp = 0;
        	while (x % i == 0) {
        		tmp++;
        		x /= i;
        	}
        	
        	if (tmp % 2 == 1) {
        		ret *= i;
        	}
        }

        System.out.println(ret * x);

        sc.close();
    }
}
0