結果

問題 No.312 置換処理
ユーザー shinwisteriashinwisteria
提出日時 2017-04-01 21:27:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 2,722 ms
コンパイル使用メモリ 74,732 KB
実行使用メモリ 58,112 KB
最終ジャッジ日時 2024-04-27 10:51:02
合計ジャッジ時間 8,953 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,472 KB
testcase_01 AC 113 ms
55,516 KB
testcase_02 AC 128 ms
58,112 KB
testcase_03 AC 113 ms
57,332 KB
testcase_04 AC 117 ms
54,164 KB
testcase_05 AC 112 ms
57,284 KB
testcase_06 AC 123 ms
56,224 KB
testcase_07 AC 122 ms
57,012 KB
testcase_08 AC 123 ms
56,912 KB
testcase_09 AC 116 ms
55,712 KB
testcase_10 AC 119 ms
56,116 KB
testcase_11 AC 127 ms
56,684 KB
testcase_12 AC 106 ms
56,444 KB
testcase_13 AC 131 ms
55,904 KB
testcase_14 AC 129 ms
56,360 KB
testcase_15 AC 118 ms
56,332 KB
testcase_16 AC 117 ms
56,288 KB
testcase_17 AC 128 ms
56,320 KB
testcase_18 AC 118 ms
55,116 KB
testcase_19 AC 114 ms
56,460 KB
testcase_20 AC 116 ms
56,740 KB
testcase_21 AC 115 ms
56,500 KB
testcase_22 AC 93 ms
52,952 KB
testcase_23 AC 98 ms
52,684 KB
testcase_24 AC 100 ms
52,832 KB
testcase_25 AC 110 ms
52,804 KB
testcase_26 AC 107 ms
54,432 KB
testcase_27 AC 113 ms
54,064 KB
testcase_28 AC 108 ms
54,020 KB
testcase_29 AC 110 ms
54,004 KB
testcase_30 AC 115 ms
54,076 KB
testcase_31 AC 113 ms
54,376 KB
testcase_32 AC 101 ms
52,968 KB
testcase_33 AC 118 ms
56,216 KB
testcase_34 AC 116 ms
56,164 KB
testcase_35 AC 110 ms
54,968 KB
testcase_36 AC 110 ms
53,928 KB
testcase_37 AC 106 ms
53,972 KB
testcase_38 AC 112 ms
54,052 KB
testcase_39 AC 113 ms
56,060 KB
testcase_40 AC 110 ms
53,928 KB
testcase_41 AC 113 ms
53,896 KB
testcase_42 AC 109 ms
53,964 KB
testcase_43 AC 114 ms
54,112 KB
testcase_44 AC 105 ms
53,388 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;
		int root = (int)Math.sqrt(N);
		if(N % 3 != 0 &&N % 4 == 0){
			N = 4;
		}else if(N % 2 == 0){
			N /= 2;
		}
		
		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