結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー AOW_MIRROR_O5AOW_MIRROR_O5
提出日時 2018-03-08 17:13:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 3,487 ms
コンパイル使用メモリ 75,316 KB
実行使用メモリ 56,000 KB
最終ジャッジ日時 2024-04-15 12:14:37
合計ジャッジ時間 8,606 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
41,548 KB
testcase_01 AC 143 ms
41,776 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 142 ms
41,756 KB
testcase_05 AC 145 ms
41,636 KB
testcase_06 AC 142 ms
41,680 KB
testcase_07 AC 144 ms
41,244 KB
testcase_08 AC 145 ms
40,872 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 139 ms
41,972 KB
testcase_12 AC 143 ms
41,720 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 138 ms
41,372 KB
testcase_17 WA -
testcase_18 AC 139 ms
41,184 KB
testcase_19 WA -
testcase_20 AC 140 ms
41,252 KB
testcase_21 WA -
testcase_22 AC 140 ms
41,576 KB
testcase_23 WA -
testcase_24 AC 138 ms
41,416 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 142 ms
41,320 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(((1+D)/2)==K){
			System.out.println(D-1);
		}else{
			System.out.println(D-2);
		}
    }
}
0