結果
問題 | No.521 Cheeses and a Mousetrap(チーズとネズミ捕り) |
ユーザー |
![]() |
提出日時 | 2017-06-04 12:54:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 1,236 ms |
コンパイル使用メモリ | 157,868 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:39:10 |
合計ジャッジ時間 | 2,121 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) typedef long long LL; LL N,K; int main(){ cin>>N>>K; if(K==0){ cout<<0<<endl; }else if(K>N){ cout<<0<<endl; }else{ if(2*K-1==N){ cout<<N-1<<endl; }else{ cout<<N-2<<endl; } } return(0); }