結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー ぴろずぴろず
提出日時 2017-06-02 22:39:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 4,389 ms
コンパイル使用メモリ 73,740 KB
実行使用メモリ 57,584 KB
最終ジャッジ日時 2023-10-21 21:08:03
合計ジャッジ時間 8,167 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
56,984 KB
testcase_01 AC 100 ms
55,980 KB
testcase_02 AC 108 ms
56,952 KB
testcase_03 AC 109 ms
57,084 KB
testcase_04 AC 111 ms
57,444 KB
testcase_05 AC 113 ms
57,124 KB
testcase_06 AC 110 ms
57,332 KB
testcase_07 AC 111 ms
57,064 KB
testcase_08 AC 111 ms
57,080 KB
testcase_09 AC 103 ms
56,160 KB
testcase_10 AC 111 ms
57,584 KB
testcase_11 AC 114 ms
57,036 KB
testcase_12 AC 120 ms
55,532 KB
testcase_13 AC 119 ms
57,528 KB
testcase_14 AC 115 ms
57,328 KB
testcase_15 AC 123 ms
57,136 KB
testcase_16 AC 111 ms
57,368 KB
testcase_17 AC 133 ms
57,052 KB
testcase_18 AC 101 ms
56,108 KB
testcase_19 AC 109 ms
57,092 KB
testcase_20 AC 101 ms
56,116 KB
testcase_21 AC 117 ms
57,424 KB
testcase_22 AC 102 ms
56,248 KB
testcase_23 AC 111 ms
55,480 KB
testcase_24 AC 111 ms
55,016 KB
testcase_25 AC 109 ms
56,944 KB
testcase_26 AC 109 ms
57,412 KB
testcase_27 AC 101 ms
56,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no521;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		if (1 <= k && k <= n) {
			if (k * 2 - 1 == n) {
				System.out.println(n - 1);
			}else{
				System.out.println(n - 2);
			}
		}else{
			System.out.println(0);
		}
	}

}
0