結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー honey208x4honey208x4
提出日時 2017-06-02 22:26:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 1,589 ms
コンパイル使用メモリ 165,392 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 22:26:43
合計ジャッジ時間 2,468 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  if (M == 0 || N < M)
    cout << 0 << endl;
  else if (N % 2 == 0)
    cout << N - 2 << endl;
  else if (N % 2 == 1) {
    if (M == N / 2 + 1)
      cout << N - 1 << endl;
    else
      cout << N - 2 << endl;
  }
  return 0;
}
0