結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー legosuke
提出日時 2017-10-23 02:40:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 1,216 ms
コンパイル使用メモリ 158,592 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 14:41:41
合計ジャッジ時間 2,199 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n, k;
  cin >> n >> k;

  if (k <= 0 || k > n) {
    cout << 0 << endl;
  } else if (n & 1) {
    cout << n - (2 * k - 1 == n ? 1 : 2) << endl;
  } else {
    cout << n - 2 << endl;
  }

  return 0;
}
0