結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー |
![]() |
提出日時 | 2017-06-09 19:27:40 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 273 bytes |
コンパイル時間 | 1,364 ms |
コンパイル使用メモリ | 55,276 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 14:33:57 |
合計ジャッジ時間 | 1,518 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<iostream> using namespace std; int main(){ int N,K; int NO=0; cin>>N>>K; if(N+1-K<=N&&N+1-K>=1) NO++; if(K>=1&&K<=N) NO++; if(NO==0) cout<<"0"<<endl; else if(NO==1) cout<<N-1<<endl; else { if(N+1-K==K) cout<<N-1<<endl; else cout<<N-2<<endl; } }