結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー GoryudyumaGoryudyuma
提出日時 2017-06-07 23:36:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 3,357 ms
コンパイル使用メモリ 73,940 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2023-10-23 19:01:24
合計ジャッジ時間 7,124 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
57,380 KB
testcase_01 AC 137 ms
57,488 KB
testcase_02 AC 133 ms
55,300 KB
testcase_03 AC 135 ms
57,192 KB
testcase_04 AC 135 ms
57,552 KB
testcase_05 AC 134 ms
55,348 KB
testcase_06 AC 133 ms
57,112 KB
testcase_07 AC 136 ms
57,168 KB
testcase_08 AC 138 ms
57,448 KB
testcase_09 AC 138 ms
57,380 KB
testcase_10 AC 138 ms
57,360 KB
testcase_11 AC 138 ms
57,108 KB
testcase_12 AC 139 ms
55,604 KB
testcase_13 AC 136 ms
57,188 KB
testcase_14 AC 138 ms
57,380 KB
testcase_15 AC 136 ms
57,188 KB
testcase_16 AC 134 ms
57,476 KB
testcase_17 AC 136 ms
57,428 KB
testcase_18 AC 133 ms
57,400 KB
testcase_19 AC 133 ms
57,348 KB
testcase_20 AC 138 ms
57,424 KB
testcase_21 AC 136 ms
57,428 KB
testcase_22 AC 135 ms
57,280 KB
testcase_23 AC 136 ms
57,384 KB
testcase_24 AC 135 ms
57,452 KB
testcase_25 AC 133 ms
57,376 KB
testcase_26 AC 136 ms
57,640 KB
testcase_27 AC 135 ms
57,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			long A = sc.nextLong(), B = sc.nextLong();
			if(B<=0 || B > A){
				A = 0;
			}else{
				if(A==B*2-1){
					A--;
				}else{
					A-=2;
				}
			}
			System.out.println(A);
		}
	}
}
0