結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
umashika
|
| 提出日時 | 2016-02-24 22:40:14 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 20,736 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 13:24:39 |
| 合計ジャッジ時間 | 728 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:13: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
9 | scanf("%lld",&n);
| ~~~^ ~~
| | |
| | int *
| long long int *
| %d
main.c:11:15: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
11 | scanf("%lld",&x[i]);
| ~~~^ ~~~~~
| | |
| | int *
| long long int *
| %d
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld",&n);
| ^~~~~~~~~~~~~~~~
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%lld",&x[i]);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int n;
int x[100000];
int i;
int count_even=0;
int count_odd =0;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&x[i]);
if(x[i]%2==0){count_even++;}//偶数ならカウント
else{count_odd++;}
}
if(count_even>=count_odd){
printf("%d\n",count_even-count_odd);
}
else{
printf("%d\n",count_odd-count_even);
}
return 0;
}
umashika