結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-12-09 23:38:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 316 bytes |
| コンパイル時間 | 270 ms |
| コンパイル使用メモリ | 33,888 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 19:03:26 |
| 合計ジャッジ時間 | 812 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &x);
| ~~~~~^~~~~~~~~~
ソースコード
#include <cstdio>
#include <algorithm>
int main(){
int N;
scanf("%d", &N);
int even = 0, odd = 0;
for(int i=0;i<N;i++){
int x;
scanf("%d", &x);
if(x % 2 == 0){even += 1;}
else{odd += 1;}
}
printf("%d\n", even+odd-std::min(even,odd)*2);
}
tottoripaper