結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| コンテスト | |
| ユーザー |
Ichimiya
|
| 提出日時 | 2020-07-09 02:24:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 382 bytes |
| コンパイル時間 | 1,578 ms |
| コンパイル使用メモリ | 165,776 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-05 12:32:45 |
| 合計ジャッジ時間 | 2,197 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int ans = 0;
int h = (N + 1) / 2;
if (N % 2) {
if (K == h) {
ans = N - 1;
}
else if (K == 0 || K > N) {
ans = 0;
}
else {
ans = N - 2;
}
}
else {
if (K == 0 || K > N) {
ans = 0;
}
else {
ans = N - 2;
}
}
cout << ans << endl;
}
Ichimiya