結果

問題 No.312 置換処理
ユーザー shinwisteriashinwisteria
提出日時 2017-04-01 21:22:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 4,023 ms
コンパイル使用メモリ 73,068 KB
実行使用メモリ 60,324 KB
最終ジャッジ日時 2023-09-22 02:15:43
合計ジャッジ時間 11,206 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 139 ms
57,896 KB
testcase_02 AC 145 ms
59,840 KB
testcase_03 AC 142 ms
57,864 KB
testcase_04 AC 122 ms
55,640 KB
testcase_05 AC 129 ms
60,324 KB
testcase_06 AC 134 ms
57,800 KB
testcase_07 AC 140 ms
57,908 KB
testcase_08 AC 135 ms
57,448 KB
testcase_09 AC 131 ms
55,948 KB
testcase_10 AC 133 ms
57,540 KB
testcase_11 AC 142 ms
58,420 KB
testcase_12 AC 134 ms
57,696 KB
testcase_13 AC 124 ms
55,648 KB
testcase_14 AC 127 ms
55,384 KB
testcase_15 AC 124 ms
55,388 KB
testcase_16 AC 124 ms
55,984 KB
testcase_17 AC 125 ms
55,732 KB
testcase_18 AC 126 ms
55,680 KB
testcase_19 AC 126 ms
55,656 KB
testcase_20 AC 126 ms
55,616 KB
testcase_21 AC 126 ms
55,744 KB
testcase_22 AC 123 ms
55,940 KB
testcase_23 AC 124 ms
55,908 KB
testcase_24 AC 124 ms
55,580 KB
testcase_25 AC 125 ms
56,292 KB
testcase_26 AC 125 ms
55,752 KB
testcase_27 AC 125 ms
56,376 KB
testcase_28 AC 123 ms
55,676 KB
testcase_29 AC 124 ms
56,276 KB
testcase_30 AC 131 ms
55,808 KB
testcase_31 AC 126 ms
55,948 KB
testcase_32 AC 131 ms
55,992 KB
testcase_33 AC 134 ms
57,724 KB
testcase_34 AC 136 ms
57,796 KB
testcase_35 AC 136 ms
58,208 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 125 ms
55,784 KB
testcase_39 AC 131 ms
57,712 KB
testcase_40 AC 127 ms
55,748 KB
testcase_41 AC 125 ms
56,092 KB
testcase_42 AC 126 ms
55,972 KB
testcase_43 AC 125 ms
56,092 KB
testcase_44 AC 123 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Chikanshori {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		long N = s.nextLong();
		s.close();
		boolean tof = true;
		if(N % 4 == 0){
			N = 4;
		}else if(N % 2 == 0){
			N /= 2;
		}
		int root = (int)Math.sqrt(N);
		int[] prime = new int[root+1];
		prime[0] = 1;
		prime[1] = 1;
		for(int i = 3;i <=root;i++){
			if(prime[i] == 0){
				for(int j = 1;j*i <= root;j++){
					prime[j*i] = 1;
				}
				if(N % i == 0){
					System.out.println(i);
					tof = false;
					break;
				}
			}
		}
		if(tof){
			System.out.println(N);
		}

	}

}
0