結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー severrabaenseverrabaen
提出日時 2019-01-30 21:23:25
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 1,759 ms
コンパイル使用メモリ 157,948 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 13:42:04
合計ジャッジ時間 2,780 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

int main() {
	long long a, b, ans;
	cin >> a >> b;
	if (b == 0 || b > a) { ans = 0; }
	else if (a % 2 == 0) { ans = a - 2; }
	else {
		if (2 * b == a + 1) { ans = a - 1; }
		else { ans = a - 2; }
	}
	cout << ans << endl;
}
0