結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
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 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
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 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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);
       }else{
           printf("%d\n", K + 1);
       }
   }
    
    
    return 0;
}
0