結果

問題 No.1052 電子機器X
ユーザー bun_bun_bskbn
提出日時 2020-05-15 21:52:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 81,472 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 09:38:45
合計ジャッジ時間 1,343 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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