結果

問題 No.1052 電子機器X
ユーザー hijiki 51hijiki 51
提出日時 2020-05-15 22:23:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 1,932 ms
コンパイル使用メモリ 186,452 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 15:01:59
合計ジャッジ時間 2,767 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    if(n%2==0){
        (k>n/2?k=n/2:k+=0);
        cout<<(k==n/2?k:(k%2==0?k+1:k-1));
    }
    else{
        (k>n/2?k=n/2+1:k+=0);
        cout<<(k%2==0?2*k+1:2*(k-1));
    }
}
0