結果
| 問題 | 
                            No.99 ジャンピング駒
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-07-01 14:33:17 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 463 bytes | 
| コンパイル時間 | 673 ms | 
| コンパイル使用メモリ | 62,848 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-13 23:56:25 | 
| 合計ジャッジ時間 | 1,464 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 WA * 4 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:14: warning: 'odd' may be used uninitialized [-Wmaybe-uninitialized]
   19 |     if (even * odd == 0){
      |         ~~~~~^~~~~
main.cpp:7:18: note: 'odd' was declared here
    7 |     int n, even, odd;
      |                  ^~~
main.cpp:19:14: warning: 'even' may be used uninitialized [-Wmaybe-uninitialized]
   19 |     if (even * odd == 0){
      |         ~~~~~^~~~~
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 ++;
        }
    }
    if (even * odd == 0){
        cout << n;
    }
    else if (n % 2 == 0){
        cout << 0;
    }
    else{
        cout << 1;
    }
    
    return 0;
}