結果

問題 No.99 ジャンピング駒
ユーザー umashikaumashika
提出日時 2016-02-24 22:40:14
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 20,960 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 19:41:44
合計ジャッジ時間 788 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
4,348 KB
testcase_01 AC 16 ms
4,348 KB
testcase_02 AC 15 ms
4,348 KB
testcase_03 AC 15 ms
4,348 KB
testcase_04 AC 15 ms
4,348 KB
testcase_05 AC 14 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:13: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
    9 |   scanf("%lld",&n);
      |          ~~~^  ~~
      |             |  |
      |             |  int *
      |             long long int *
      |          %d
main.c:11:15: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
   11 |     scanf("%lld",&x[i]);
      |            ~~~^  ~~~~~
      |               |  |
      |               |  int *
      |               long long int *
      |            %d
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%lld",&n);
      |   ^~~~~~~~~~~~~~~~
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%lld",&x[i]);
      |     ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main()
{
  int n;
  int x[100000];
  int i;
  int count_even=0;
  int count_odd =0;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&x[i]);
    if(x[i]%2==0){count_even++;}//偶数ならカウント
    else{count_odd++;}
  }
  if(count_even>=count_odd){
    printf("%d\n",count_even-count_odd);
  }
  else{
    printf("%d\n",count_odd-count_even);
  }

  return 0;
}
0