結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー |
![]() |
提出日時 | 2017-06-02 22:25:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 614 ms |
コンパイル使用メモリ | 82,640 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-21 22:25:59 |
合計ジャッジ時間 | 1,413 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<stdio.h> #include<iostream> #include<string> #include<vector> #include<map> #include<list> #include<queue> #include<deque> #include<algorithm> #include<utility> #include<memory> #include<cmath> #define ALL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define pb push_back using namespace std; typedef long long ll; typedef pair<int,int> P; const int mod=1e9+7,INF=1<<30; const double EPS=1e-12,PI=3.1415926535897932384626; const int MAX_N=9; const ll LINF=100000000000000000; int main(){ int N,K; cin >> N >> K ; int ans; if(K<=0 || K>N) ans=0; else if(N%2==1 && K==N/2+1) ans=N-1; else ans=N-2; cout << ans << endl; return 0; }