結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー shinwisteriashinwisteria
提出日時 2018-03-13 20:37:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 4,029 ms
コンパイル使用メモリ 72,180 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-08-15 10:28:54
合計ジャッジ時間 8,274 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
53,964 KB
testcase_01 AC 112 ms
56,060 KB
testcase_02 AC 112 ms
56,216 KB
testcase_03 AC 109 ms
55,844 KB
testcase_04 AC 112 ms
55,900 KB
testcase_05 AC 117 ms
55,804 KB
testcase_06 AC 111 ms
56,488 KB
testcase_07 AC 116 ms
55,520 KB
testcase_08 AC 112 ms
56,376 KB
testcase_09 AC 115 ms
56,048 KB
testcase_10 AC 115 ms
56,028 KB
testcase_11 AC 112 ms
56,100 KB
testcase_12 AC 117 ms
56,148 KB
testcase_13 AC 113 ms
55,768 KB
testcase_14 AC 114 ms
55,800 KB
testcase_15 AC 117 ms
55,976 KB
testcase_16 AC 114 ms
55,516 KB
testcase_17 AC 112 ms
55,720 KB
testcase_18 AC 113 ms
55,536 KB
testcase_19 AC 114 ms
55,896 KB
testcase_20 AC 117 ms
55,936 KB
testcase_21 AC 111 ms
55,820 KB
testcase_22 AC 108 ms
55,736 KB
testcase_23 AC 111 ms
55,860 KB
testcase_24 AC 109 ms
56,036 KB
testcase_25 AC 110 ms
55,848 KB
testcase_26 AC 112 ms
56,304 KB
testcase_27 AC 112 ms
56,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con521 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt() , k = s.nextInt();
		s.close();

		if(k == 0 || k > n){
			System.out.println(0);
		}else if(n % 2 == 1 && k == (n+1)/2){
			System.out.println(n-1);
		}else{
			System.out.println(n-2);
		}

	}

}
0