結果

問題 No.99 ジャンピング駒
ユーザー mosmos_21mosmos_21
提出日時 2016-10-12 18:50:55
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 202 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 19:20:41
合計ジャッジ時間 814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,812 KB
testcase_01 AC 13 ms
6,944 KB
testcase_02 AC 13 ms
6,948 KB
testcase_03 AC 13 ms
6,940 KB
testcase_04 AC 13 ms
6,944 KB
testcase_05 AC 14 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%d" ,&n);
      |   ^~~~~~~~~~~~~~~
main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     scanf("%d", &i);
      |     ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){

  int i, n, s = 0;

  scanf("%d" ,&n);

  while(n > 0){
    scanf("%d", &i);
    i % 2 ? s++ : s--;
    n--;
  }
  if(s < 0) s *= -1;
  printf("%d\n", s);
  return 0;
}
0