結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-02 23:00:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 372 bytes |
| コンパイル時間 | 363 ms |
| コンパイル使用メモリ | 30,336 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-22 02:46:15 |
| 合計ジャッジ時間 | 1,485 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:22:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%d", &X);
| ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define READ_BUFSIZE ( 1024 )
#define READ_DELIMITER ( " " )
int main(int argc, char *argv[])
{
int N = 0;
scanf("%d", &N);
int X = 0;
int A = 0;
for (int i = 0; i < N; i++)
{
scanf("%d", &X);
if (X % 2)
A++;
else
A--;
}
printf("%d\n", abs( A ));
return 0;
}