結果

問題 No.1052 電子機器X
ユーザー non3kzxnon3kzx
提出日時 2020-05-22 17:35:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 509 bytes
コンパイル時間 2,553 ms
コンパイル使用メモリ 74,100 KB
実行使用メモリ 50,400 KB
最終ジャッジ日時 2024-04-15 09:19:35
合計ジャッジ時間 4,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
50,204 KB
testcase_01 AC 59 ms
50,160 KB
testcase_02 AC 57 ms
50,248 KB
testcase_03 AC 58 ms
50,304 KB
testcase_04 AC 57 ms
49,864 KB
testcase_05 AC 60 ms
50,316 KB
testcase_06 AC 57 ms
49,960 KB
testcase_07 AC 55 ms
50,264 KB
testcase_08 AC 56 ms
50,400 KB
testcase_09 AC 59 ms
50,212 KB
testcase_10 AC 56 ms
50,024 KB
testcase_11 AC 58 ms
50,244 KB
testcase_12 AC 58 ms
50,320 KB
testcase_13 AC 56 ms
50,284 KB
testcase_14 AC 55 ms
50,156 KB
testcase_15 AC 59 ms
49,968 KB
testcase_16 AC 57 ms
50,220 KB
testcase_17 AC 56 ms
50,200 KB
testcase_18 AC 59 ms
50,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] str = reader.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int K = Integer.parseInt(str[1]);
		if (N % 2 == 1) {
			int ans = Math.min(N, 1+K);
			System.out.println(ans);
		}
		else {
			int ans = Math.min(N/2, 1+K);
			System.out.println(ans);
		}


	}
}
0