結果

問題 No.312 置換処理
ユーザー fal_rndfal_rnd
提出日時 2016-10-29 17:47:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 2,731 ms
コンパイル使用メモリ 74,864 KB
実行使用メモリ 54,584 KB
最終ジャッジ日時 2024-04-27 10:48:03
合計ジャッジ時間 9,277 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,016 KB
testcase_01 AC 147 ms
54,384 KB
testcase_02 AC 151 ms
54,288 KB
testcase_03 AC 142 ms
54,060 KB
testcase_04 AC 137 ms
54,392 KB
testcase_05 AC 132 ms
54,112 KB
testcase_06 AC 133 ms
53,824 KB
testcase_07 AC 137 ms
53,944 KB
testcase_08 AC 132 ms
53,992 KB
testcase_09 AC 118 ms
52,920 KB
testcase_10 AC 132 ms
53,980 KB
testcase_11 AC 134 ms
54,408 KB
testcase_12 AC 133 ms
54,220 KB
testcase_13 AC 129 ms
54,108 KB
testcase_14 AC 132 ms
54,000 KB
testcase_15 AC 132 ms
54,272 KB
testcase_16 AC 129 ms
54,360 KB
testcase_17 AC 131 ms
54,224 KB
testcase_18 AC 116 ms
52,904 KB
testcase_19 AC 132 ms
54,060 KB
testcase_20 AC 118 ms
52,796 KB
testcase_21 AC 135 ms
54,204 KB
testcase_22 AC 135 ms
54,208 KB
testcase_23 AC 130 ms
54,208 KB
testcase_24 AC 131 ms
54,052 KB
testcase_25 AC 134 ms
54,112 KB
testcase_26 AC 130 ms
54,584 KB
testcase_27 AC 131 ms
54,224 KB
testcase_28 AC 132 ms
54,244 KB
testcase_29 AC 130 ms
54,236 KB
testcase_30 AC 129 ms
54,040 KB
testcase_31 AC 128 ms
54,080 KB
testcase_32 AC 133 ms
53,964 KB
testcase_33 AC 139 ms
54,176 KB
testcase_34 AC 138 ms
54,080 KB
testcase_35 AC 133 ms
53,964 KB
testcase_36 AC 130 ms
54,116 KB
testcase_37 AC 132 ms
54,248 KB
testcase_38 AC 127 ms
54,104 KB
testcase_39 AC 116 ms
52,920 KB
testcase_40 AC 129 ms
54,076 KB
testcase_41 AC 131 ms
54,092 KB
testcase_42 AC 137 ms
54,028 KB
testcase_43 AC 145 ms
53,980 KB
testcase_44 AC 129 ms
54,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class B{
	static Scanner s = new Scanner(System.in);

	public static void main(String[] args) {
		long in = s.nextLong();
		if(in%3==0){
			System.out.println(3);
			return;
		}
		if(in%4==0){
			System.out.println(4);
			return;
		}
		if(in%2==0)
			in/=2;
		long l = (long)(Math.sqrt(in)+0.6);
		long c = 5;
		while(in%c!=0){
			c+=2;
			if(c>l){
				System.out.println(in);
				return;
			}
		}
		System.out.println(c);
	}
}
0