結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| ユーザー |
hiyokko2
|
| 提出日時 | 2017-06-02 22:26:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 731 bytes |
| コンパイル時間 | 593 ms |
| コンパイル使用メモリ | 79,132 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 22:26:45 |
| 合計ジャッジ時間 | 1,398 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
//#define LOCAL
#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
//#define int long long
//typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
#define MOD 1000000007
using namespace std;
signed main()
{
#ifdef LOCAL
ifstream in("input.txt");
cin.rdbuf(in.rdbuf());
#endif
int N, K;
cin >> N >> K;
if (K == 0 || K > N) {
cout << 0 << endl;
return 0;
}
if (N % 2 == 0) {
cout << N - 2 << endl;
} else {
if (K == N / 2 + 1) {
cout << N - 1 << endl;
} else {
cout << N - 2 << endl;
}
}
}
hiyokko2