結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ぴろず
                         | 
                    
| 提出日時 | 2015-11-13 23:19:55 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 395 bytes | 
| コンパイル時間 | 2,051 ms | 
| コンパイル使用メモリ | 74,048 KB | 
| 実行使用メモリ | 61,192 KB | 
| 最終ジャッジ日時 | 2024-09-13 15:14:46 | 
| 合計ジャッジ時間 | 4,845 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 TLE * 1 | 
| other | -- * 43 | 
ソースコード
package no300;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long x_ = x;
		long y = 1;
		for(int i=2;i*i<=x_;i++) {
			int a = 0;
			while(x % i == 0) {
				x /= i;
				a++;
			}
			if (a % 2 == 1) {
				y *= i;
			}
		}
		if (x > 1) {
			y *= x;
		}
		System.out.println(y);
	}
}
            
            
            
        
            
ぴろず