結果

問題 No.99 ジャンピング駒
ユーザー Bantako
提出日時 2017-07-09 20:00:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 266 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 23,680 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-07 04:53:42
合計ジャッジ時間 852 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&X);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
main(){
    int N;
    int X;
    int odd = 0;
    int even = 0;
    scanf("%d",&N);
    for(int i = 0;i < N;i++){
        scanf("%d",&X);
        if(X%2==0){even++;}
        else{odd++;}
    }
    printf("%d\n",abs(even-odd));
}
0