結果

問題 No.300 平方数
ユーザー tsunabittsunabit
提出日時 2020-03-26 13:02:50
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 4,887 ms
コンパイル使用メモリ 72,172 KB
実行使用メモリ 59,992 KB
最終ジャッジ日時 2023-08-30 12:20:19
合計ジャッジ時間 11,165 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
59,992 KB
testcase_01 AC 124 ms
55,808 KB
testcase_02 AC 124 ms
55,844 KB
testcase_03 AC 123 ms
56,412 KB
testcase_04 AC 125 ms
55,796 KB
testcase_05 AC 121 ms
54,208 KB
testcase_06 AC 123 ms
55,992 KB
testcase_07 AC 124 ms
55,892 KB
testcase_08 AC 122 ms
55,776 KB
testcase_09 AC 123 ms
55,912 KB
testcase_10 AC 122 ms
55,608 KB
testcase_11 AC 124 ms
55,912 KB
testcase_12 AC 123 ms
55,568 KB
testcase_13 WA -
testcase_14 AC 126 ms
55,948 KB
testcase_15 AC 124 ms
55,896 KB
testcase_16 WA -
testcase_17 AC 121 ms
55,376 KB
testcase_18 AC 125 ms
55,904 KB
testcase_19 AC 124 ms
56,276 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

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