結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー | yansi819 |
提出日時 | 2024-03-31 10:19:46 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 402 bytes |
コンパイル時間 | 3,804 ms |
コンパイル使用メモリ | 260,992 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 17:51:46 |
合計ジャッジ時間 | 4,774 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#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; }