結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー Lanatus
提出日時 2024-01-08 20:30:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 1,942 ms
コンパイル使用メモリ 191,204 KB
最終ジャッジ日時 2025-02-18 16:32:10
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void) {
	long long a, b;
	cin >> a >> b;
	
	if (b >= 1 && b <= a) {
		if (a % 2 && (a + 1) / 2 == b) cout << max(0LL, a - 1) << endl;
		else cout << max(0LL, a - 2) << endl;
	}
	else cout << 0 << endl;
	return 0;
}
0