結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
41,564 KB
testcase_01 AC 138 ms
41,180 KB
testcase_02 AC 137 ms
41,308 KB
testcase_03 AC 141 ms
41,580 KB
testcase_04 AC 135 ms
41,292 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 137 ms
41,416 KB
testcase_09 AC 140 ms
41,040 KB
testcase_10 AC 141 ms
41,464 KB
testcase_11 WA -
testcase_12 AC 139 ms
41,320 KB
testcase_13 AC 141 ms
41,692 KB
testcase_14 AC 139 ms
41,408 KB
testcase_15 AC 136 ms
41,392 KB
testcase_16 AC 146 ms
41,348 KB
testcase_17 WA -
testcase_18 AC 142 ms
41,516 KB
testcase_19 WA -
testcase_20 AC 142 ms
41,744 KB
testcase_21 WA -
testcase_22 AC 139 ms
41,264 KB
testcase_23 WA -
testcase_24 AC 137 ms
41,680 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
		}
		
		if(K>0 && ((1+D)/2)>K){
			System.out.println(D-2);
		}
    }
}
0