結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー yansi819
提出日時 2024-03-31 10:19:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 3,991 ms
コンパイル使用メモリ 250,280 KB
最終ジャッジ日時 2025-02-20 16:08:41
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

ll N, K;

int main() {
  cin >> N >> K;
  if (K == 0 || K > N || K == 1 && N == 1) cout << 0 << endl;
  else if (N % 2 == 1) {
    if (K == N / 2 + 1) cout << N - 1 << endl;
    else cout << N - 2 << endl;
  } else {
    cout << N - 2 << endl;
  }
  return 0;
}
0