結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-23 17:04:15 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 275 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 03:56:37 |
| 合計ジャッジ時間 | 837 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
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",&x);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int x,ans=0,i,N;
scanf("%d",&N);
for (i=0;i<N;i++) {
scanf("%d",&x);
if (x%2==0) {
ans++;
} else {
ans--;
}
}
if (ans>0) {
printf("%d\n",ans);
} else {
printf("%d\n",-ans);
}
return 0;
}