結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-25 10:21:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 339 bytes |
| コンパイル時間 | 1,526 ms |
| コンパイル使用メモリ | 165,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 20:16:37 |
| 合計ジャッジ時間 | 2,393 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 6 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:22: warning: 'even' may be used uninitialized [-Wmaybe-uninitialized]
20 | cout << abs(even - odd) << endl;
| ~~~~~^~~~~
main.cpp:6:12: note: 'even' was declared here
6 | int n, even, odd = 0;
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, even, odd = 0;
cin >> n;
int tmp;
for (int i = 0; i < n; i++) {
cin >> tmp;
if(tmp % 2 == 0) {
even++;
} else {
odd++;
}
}
cout << abs(even - odd) << endl;
return 0;
}