結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー tenten
提出日時 2021-02-09 08:44:20
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 73,924 KB
実行使用メモリ 54,392 KB
最終ジャッジ日時 2024-07-06 14:11:51
合計ジャッジ時間 7,082 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ans;
        if (k == 0 || k > n) {
            ans = 0;
        } else if (k % 2 == 1 && (k + 1) / 2 == k) {
            ans = n - 1;
        } else {
            ans = n - 2;
        }
        System.out.println(ans);
    }
}
0