結果

問題 No.1052 電子機器X
ユーザー コーヒー太郎コーヒー太郎
提出日時 2020-05-25 11:33:25
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 03:41:58
合計ジャッジ時間 1,230 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main(void){
    int N, K;
    
    scanf("%d %d", &N, &K);
    
   if((N % 2 == 0 && K % 2 == 0) || (N % 2 == 0 && K % 2 != 0)){
       if(N - K * 2 <= 1){
           printf("%d\n", N / 2);
       }else{
           printf("%d\n", K + 1);
       }
       
   }else{
        if(N - K * 2 <= 1){
           printf("%d\n", N - 1);
       }else{
           printf("%d\n", K + 1);
       }
   }
    
    
    return 0;
}
0