結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー AOW_MIRROR_O5AOW_MIRROR_O5
提出日時 2018-03-08 17:30:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 4,057 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 42,064 KB
最終ジャッジ日時 2024-04-15 12:16:04
合計ジャッジ時間 8,580 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,848 KB
testcase_01 AC 137 ms
41,204 KB
testcase_02 AC 144 ms
41,428 KB
testcase_03 AC 145 ms
41,416 KB
testcase_04 AC 142 ms
41,460 KB
testcase_05 AC 143 ms
41,488 KB
testcase_06 AC 143 ms
41,564 KB
testcase_07 AC 146 ms
41,068 KB
testcase_08 AC 143 ms
40,976 KB
testcase_09 AC 140 ms
41,320 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 139 ms
41,624 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 138 ms
41,564 KB
testcase_17 AC 137 ms
41,644 KB
testcase_18 AC 141 ms
41,388 KB
testcase_19 AC 140 ms
40,972 KB
testcase_20 AC 139 ms
41,392 KB
testcase_21 AC 141 ms
41,428 KB
testcase_22 AC 140 ms
41,808 KB
testcase_23 AC 143 ms
41,196 KB
testcase_24 AC 144 ms
41,264 KB
testcase_25 AC 141 ms
41,388 KB
testcase_26 AC 143 ms
42,064 KB
testcase_27 AC 144 ms
41,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class paiza7 {
    public static void main(String[] args) {
		
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
		int K = sc.nextInt();
		
		if(K==0 || K>N){
			System.out.println(0);
		}
		
		if(N%2 == 1){
			if(((1+N)/2)==K){
				System.out.println(N-1);
			}
			if(K>0 && ((1+N)/2)>K){
				System.out.println(N-2);
			}
    	}
		
		if(N%2 == 0){
			System.out.println(N-2);
    	}
    }
}
0