結果
| 問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
| コンテスト | |
| ユーザー |
masakt
|
| 提出日時 | 2017-06-03 00:09:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,019 bytes |
| コンパイル時間 | 731 ms |
| コンパイル使用メモリ | 71,884 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 03:42:00 |
| 合計ジャッジ時間 | 1,550 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// Powered by caide (code generator, tester, and library code inliner)
class Solution {
public:
void solve(std::istream& in, std::ostream& out) {
int n, k;
int ans = 0;
in >> n >> k;
if (k == 0 || k > n)
{
ans = 0;
}
else
{
ans = n == 2 * k - 1 ? n - 1 : n - 2;
}
out << ans;
}
};
void solve(std::istream& in, std::ostream& out)
{
out << std::setprecision(12);
Solution solution;
solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
istream& in = cin;
ostream& out = cout;
solve(in, out);
return 0;
}
masakt