結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー mosmos_21mosmos_21
提出日時 2017-06-20 11:43:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 2,394 ms
コンパイル使用メモリ 74,384 KB
実行使用メモリ 41,320 KB
最終ジャッジ日時 2024-10-02 03:36:52
合計ジャッジ時間 6,862 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        int N = in.nextInt(), K = in.nextInt();
        if (K < 1 || N < K) {
            System.out.println(0);
        } else if (K == N / 2 + 1 && N % 2 == 1) {
            System.out.println(N - 1);
        } else {
            System.out.println(N - 2);
        }
    }
}
0