結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| コンテスト | |
| ユーザー |
yukiteru
|
| 提出日時 | 2018-02-05 16:42:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 720 bytes |
| コンパイル時間 | 838 ms |
| コンパイル使用メモリ | 81,380 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 00:58:52 |
| 合計ジャッジ時間 | 1,612 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
int main(void) {
long long int n, k;
cin >> n >> k;
if (k == 0 || k > n) {
cout << 0 << endl;
}
else if (n % 2 == 0) {
cout << n - 2 << endl;
}
else {
if (n / 2 + 1 == k) {
cout << n - 1 << endl;
}
else {
cout << n - 2 << endl;
}
}
return 0;
}
yukiteru