結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー snrnsidy
提出日時 2021-06-10 13:08:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 192,264 KB
最終ジャッジ日時 2025-01-22 05:15:40
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;

	cin >> n >> k;

	if (n < k || k==0)
	{
		cout << 0 << '\n';
	}
	else
	{
		if (n - k + 1 == k)
		{
			cout << n - 1 << '\n';
		}
		else
		{
			cout << n - 2 << '\n';
		}
	}

	return 0;
}
0