結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー |
|
提出日時 | 2017-06-02 22:23:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 1,668 ms |
コンパイル使用メモリ | 165,512 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 22:23:53 |
合計ジャッジ時間 | 2,449 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))#define all(x) (x).begin(),(x).end()#define pb push_back#define fi first#define se second#define dbg(x) cout<<#x" = "<<((x))<<endltemplate<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}int solve(int n, int k){if(1<=k && k<=n){if(n%2==1 && k==(n+1)/2) return n-1;return n-2;}return 0;}int main(){int n,k;cin >>n >>k;cout << solve(n,k) << endl;return 0;}