結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
54,000 KB
testcase_01 AC 143 ms
54,204 KB
testcase_02 AC 142 ms
53,992 KB
testcase_03 AC 141 ms
54,488 KB
testcase_04 AC 142 ms
54,132 KB
testcase_05 AC 139 ms
54,084 KB
testcase_06 AC 146 ms
54,228 KB
testcase_07 AC 144 ms
54,232 KB
testcase_08 AC 145 ms
54,300 KB
testcase_09 AC 146 ms
54,344 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 148 ms
54,288 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 141 ms
53,936 KB
testcase_17 AC 141 ms
54,280 KB
testcase_18 AC 141 ms
54,008 KB
testcase_19 AC 141 ms
54,236 KB
testcase_20 AC 143 ms
54,192 KB
testcase_21 AC 140 ms
54,252 KB
testcase_22 AC 137 ms
54,092 KB
testcase_23 AC 143 ms
53,944 KB
testcase_24 AC 142 ms
54,420 KB
testcase_25 AC 147 ms
54,160 KB
testcase_26 AC 150 ms
54,344 KB
testcase_27 AC 144 ms
54,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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