結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2015-06-04 13:26:49 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 238 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 14:06:39 |
| 合計ジャッジ時間 | 827 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:24: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
12 | printf("%d\n", abs(even - odd));
| ^~~
main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 |
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &X);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main(void) {
int i, N, X, odd = 0, even = 0;
scanf("%d", &N);
for(i = 1;i <= N;i++){
scanf("%d", &X);
if(X % 2 == 0)even++;
else odd++;
}
printf("%d\n", abs(even - odd));
return 0;
}
suppy193