結果

問題 No.300 平方数
ユーザー tsunabit
提出日時 2020-03-26 13:02:50
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 3,408 ms
コンパイル使用メモリ 77,092 KB
実行使用メモリ 111,576 KB
最終ジャッジ日時 2025-01-02 01:16:26
合計ジャッジ時間 49,688 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 6 TLE * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No300 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		int s = 2;
		int c = 0, y = 1;
		while(x > 1) {
//			System.out.println("x = " + x + ", c = " + c + ", y = " + y);
			if(x%s == 0) {
				c += 1;
				x = x/s;
			}else {
				if(c%2 != 0) {
					y *= s;
				}
				s += 1;
				c = 0;
			}
		}
		if(c%2 != 0) y *= s;
		System.out.println(y);
	}
}
0