結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-09-30 01:51:25 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 408 bytes |
| コンパイル時間 | 1,092 ms |
| コンパイル使用メモリ | 91,340 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-30 01:51:28 |
| 合計ジャッジ時間 | 2,253 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll n,k;
cin>>n>>k;
if(k==0||k>n) {
cout<<0<<endl;
return 0;
}
ll ans = 0;
if(k==n-k+1){
ans = n - 1;
}else{
ans = n - 2;
}
ans = max(ans,0ll);
cout<<ans<<endl;
}
momoyuu