結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             samplelpmas
                         | 
                    
| 提出日時 | 2017-04-20 18:43:25 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 511 bytes | 
| コンパイル時間 | 1,769 ms | 
| コンパイル使用メモリ | 74,008 KB | 
| 実行使用メモリ | 41,664 KB | 
| 最終ジャッジ日時 | 2024-07-19 21:10:00 | 
| 合計ジャッジ時間 | 8,211 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 34 | 
ソースコード
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = 1;
        for (long i = 2; (i * i) <= x; i++) {
            int factorCount = 0;
            while (x % i == 0) {
                x /= i;
                factorCount++;
            }
            if (factorCount % 2 != 0) {
                y *= i;
            }
        }
        System.out.println(y);
    }
}
            
            
            
        
            
samplelpmas