結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-01 14:34:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 363 bytes |
| コンパイル時間 | 542 ms |
| コンパイル使用メモリ | 63,104 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-13 23:58:16 |
| 合計ジャッジ時間 | 1,368 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 6 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:22: warning: 'odd' may be used uninitialized [-Wmaybe-uninitialized]
19 | cout << abs(even - odd) << endl;
| ~~~~~^~~~~
main.cpp:7:18: note: 'odd' was declared here
7 | int n, even, odd;
| ^~~
main.cpp:19:22: warning: 'even' may be used uninitialized [-Wmaybe-uninitialized]
19 | cout << abs(even - odd) << endl;
| ~~~~~^~~~~
main.cpp:7:12: note: 'even' was declared here
7 | int n, even, odd;
| ^~~~
ソースコード
#include <iostream>
#include<string>
using namespace std;
using ll = long long int;
int main(void){
int n, even, odd;
cin >> n;
ll x;
for (int i = 0; i < n; i ++){
cin >> x;
if (x % 2 == 0){
even ++;
}
else{
odd ++;
}
}
cout << abs(even - odd) << endl;
return 0;
}