結果

問題 No.192 合成数
ユーザー m4s4k1ch1m4s4k1ch1
提出日時 2015-05-28 15:05:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 71,816 KB
実行使用メモリ 49,604 KB
最終ジャッジ日時 2023-09-09 08:29:55
合計ジャッジ時間 4,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,184 KB
testcase_01 AC 40 ms
49,124 KB
testcase_02 AC 40 ms
49,124 KB
testcase_03 AC 39 ms
49,208 KB
testcase_04 AC 40 ms
49,216 KB
testcase_05 AC 39 ms
47,232 KB
testcase_06 AC 39 ms
49,040 KB
testcase_07 AC 40 ms
49,468 KB
testcase_08 AC 39 ms
49,308 KB
testcase_09 AC 39 ms
49,252 KB
testcase_10 AC 39 ms
49,228 KB
testcase_11 AC 39 ms
49,604 KB
testcase_12 AC 40 ms
49,216 KB
testcase_13 AC 41 ms
49,232 KB
testcase_14 AC 40 ms
49,056 KB
testcase_15 AC 40 ms
49,212 KB
testcase_16 AC 41 ms
49,044 KB
testcase_17 AC 40 ms
49,300 KB
testcase_18 AC 40 ms
49,008 KB
testcase_19 AC 39 ms
49,112 KB
testcase_20 AC 39 ms
49,532 KB
testcase_21 AC 40 ms
49,268 KB
testcase_22 AC 40 ms
49,216 KB
testcase_23 AC 39 ms
49,404 KB
testcase_24 AC 39 ms
49,228 KB
testcase_25 AC 40 ms
49,208 KB
testcase_26 AC 39 ms
49,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int n = Integer.parseInt(line);
		int min = n - 100;
		if (min < 3) {
			min = 3;
		}
		
		int max = n + 100;
		
		if (n % 2 == 0) {
			System.out.println(n);
			return;
		}
		
		for (int i = min; i < max; i ++) {
			for (int j = 2; j < i; j+=2) {
				if (i % j == 0) {
					System.out.println(i);
					return;
				}
			}
		}
	}
}
0