結果

問題 No.1052 電子機器X
ユーザー bun_bun_bskbnbun_bun_bskbn
提出日時 2020-05-15 21:52:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 81,196 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 13:30:04
合計ジャッジ時間 1,405 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<queue>
using namespace std;
int main() {
	int N, K;
	cin >> N >> K;
	int count;
	if (N % 2 == 1) {
		if (2*(K-1) >= N) {
			count = N;
		}
		else if(K==1){
			count = 2*K;
		}
		else {
			count = 2 * (K - 1);
		}
	}
	else {
		if (2 * K >= N)count = N / 2;
		else count = K;
	}
	cout << count<<endl;
}
0