結果

問題 No.300 平方数
ユーザー tsunabittsunabit
提出日時 2020-03-26 14:56:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 530 bytes
コンパイル時間 6,315 ms
コンパイル使用メモリ 71,728 KB
実行使用メモリ 57,704 KB
最終ジャッジ日時 2023-08-30 12:39:09
合計ジャッジ時間 12,973 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
55,636 KB
testcase_01 AC 126 ms
55,432 KB
testcase_02 AC 128 ms
55,400 KB
testcase_03 AC 131 ms
55,676 KB
testcase_04 AC 128 ms
55,432 KB
testcase_05 AC 128 ms
56,016 KB
testcase_06 AC 129 ms
55,728 KB
testcase_07 AC 133 ms
55,840 KB
testcase_08 AC 131 ms
55,956 KB
testcase_09 AC 127 ms
55,424 KB
testcase_10 AC 130 ms
55,760 KB
testcase_11 AC 128 ms
53,952 KB
testcase_12 AC 128 ms
55,880 KB
testcase_13 AC 143 ms
55,712 KB
testcase_14 AC 126 ms
57,704 KB
testcase_15 AC 129 ms
55,736 KB
testcase_16 AC 138 ms
55,544 KB
testcase_17 AC 129 ms
55,636 KB
testcase_18 AC 128 ms
55,760 KB
testcase_19 AC 131 ms
55,816 KB
testcase_20 AC 133 ms
55,436 KB
testcase_21 AC 138 ms
55,732 KB
testcase_22 AC 135 ms
55,728 KB
testcase_23 AC 137 ms
54,236 KB
testcase_24 AC 135 ms
55,584 KB
testcase_25 AC 144 ms
55,748 KB
testcase_26 AC 139 ms
55,420 KB
testcase_27 AC 135 ms
55,688 KB
testcase_28 AC 142 ms
55,916 KB
testcase_29 AC 143 ms
55,796 KB
testcase_30 AC 145 ms
55,932 KB
testcase_31 AC 137 ms
55,724 KB
testcase_32 AC 141 ms
55,888 KB
testcase_33 AC 138 ms
55,816 KB
testcase_34 AC 145 ms
55,840 KB
testcase_35 AC 138 ms
53,748 KB
testcase_36 AC 141 ms
55,836 KB
testcase_37 AC 140 ms
55,748 KB
testcase_38 AC 131 ms
55,400 KB
testcase_39 AC 140 ms
55,848 KB
testcase_40 AC 140 ms
55,824 KB
testcase_41 AC 137 ms
55,588 KB
testcase_42 AC 133 ms
55,576 KB
testcase_43 AC 136 ms
55,724 KB
testcase_44 AC 143 ms
55,408 KB
testcase_45 AC 140 ms
55,732 KB
権限があれば一括ダウンロードができます

ソースコード

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 c = 0;
//		int y = 1;
		long i = 2;
		while(x >= (i*i)) {
//		for(int i = 2; i <= x; ) {
//			System.out.println("i = " + i + ", x = " + x);
			if(x%(i*i) == 0) {
				x /= i*i; 
//				c += 1;
			}else {
//				if(c%2 != 0) {
//					y *= i;
//				}
//				c = 0;
				i += 1;
			}
		}
//		if(c%2 != 0) y *= i;
		System.out.println(x);
	}
}
0