結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー Mcpu3Mcpu3
提出日時 2018-06-29 16:37:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 70,996 KB
実行使用メモリ 58,076 KB
最終ジャッジ日時 2023-09-13 15:11:54
合計ジャッジ時間 6,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
58,076 KB
testcase_01 AC 120 ms
55,664 KB
testcase_02 AC 120 ms
55,984 KB
testcase_03 AC 121 ms
56,084 KB
testcase_04 AC 119 ms
55,864 KB
testcase_05 AC 119 ms
56,104 KB
testcase_06 AC 119 ms
53,932 KB
testcase_07 AC 119 ms
55,972 KB
testcase_08 AC 120 ms
55,972 KB
testcase_09 AC 119 ms
56,120 KB
testcase_10 AC 120 ms
56,120 KB
testcase_11 AC 118 ms
55,792 KB
testcase_12 AC 120 ms
56,192 KB
testcase_13 AC 119 ms
55,976 KB
testcase_14 AC 118 ms
56,068 KB
testcase_15 AC 120 ms
55,860 KB
testcase_16 AC 119 ms
56,064 KB
testcase_17 AC 120 ms
56,500 KB
testcase_18 AC 127 ms
55,796 KB
testcase_19 AC 122 ms
56,084 KB
testcase_20 AC 124 ms
55,960 KB
testcase_21 AC 119 ms
56,024 KB
testcase_22 AC 120 ms
55,668 KB
testcase_23 AC 120 ms
55,528 KB
testcase_24 AC 121 ms
55,836 KB
testcase_25 AC 120 ms
55,828 KB
testcase_26 AC 120 ms
56,088 KB
testcase_27 AC 119 ms
55,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no521{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),k=stdIn.nextInt();
		if(k==0||k>n) n=0;
		else if(n%2!=0) {
			if((n+1)/2==k) n--;
			else n-=2;
		}
		else n-=2;
		System.out.print(n);
	}
}
0