結果

問題 No.415 ぴょん
ユーザー notetonousnotetonous
提出日時 2016-08-27 00:31:46
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 04:54:36
合計ジャッジ時間 964 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 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 WA -
testcase_10 AC 0 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 0 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 0 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 0 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |   scanf("%d %d",&N,&D);
      |   ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
  int N,D;
  scanf("%d %d",&N,&D);
  if(D==1){
    printf("%d\n",N-1);
    return 0;
  }
  if(D==N){
    printf("0\n");
    return 0;
  }
  if(N%2==0){
    if(D>N/2)D=N-D;
    printf("%d\n",(N-1)/2);
    return 0;
  }
  else{
    printf("%d\n",N-1);
    return 0;
  }
}
0