結果

問題 No.300 平方数
ユーザー hhgfhn1hhgfhn1
提出日時 2018-11-03 18:36:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 59,456 KB
最終ジャッジ日時 2024-04-30 21:29:49
合計ジャッジ時間 8,774 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
52,904 KB
testcase_01 AC 105 ms
53,112 KB
testcase_02 AC 127 ms
56,168 KB
testcase_03 AC 102 ms
52,744 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 125 ms
54,220 KB
testcase_08 AC 121 ms
54,116 KB
testcase_09 AC 105 ms
54,116 KB
testcase_10 AC 116 ms
54,220 KB
testcase_11 AC 108 ms
54,264 KB
testcase_12 AC 116 ms
54,252 KB
testcase_13 WA -
testcase_14 AC 108 ms
52,904 KB
testcase_15 AC 134 ms
56,084 KB
testcase_16 AC 120 ms
55,236 KB
testcase_17 AC 141 ms
58,376 KB
testcase_18 AC 118 ms
54,152 KB
testcase_19 AC 134 ms
56,284 KB
testcase_20 WA -
testcase_21 AC 127 ms
57,428 KB
testcase_22 AC 125 ms
55,812 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 122 ms
55,340 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 133 ms
56,376 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		long x=scanner.nextLong();
		int p[]=prime_fact(x);
		long ans=1;
		for(int i=1;i<p.length;i++) {
			if(p[i]%2==1) {
				ans*=i;
			}
		}
		System.out.println(ans);
	}

	private static int[] prime_fact(long x) {
		double d = Math.sqrt(x);
		int res[] = new int[(int) d + 1];
		for (int i = 2; i <= d; i++) {
			while (x % i == 0) {
				x /= i;
				res[i]++;
			}
		}
		return res;
	}
}
0