結果

問題 No.99 ジャンピング駒
ユーザー 👑 rin204rin204
提出日時 2020-07-01 14:33:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 63,476 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-11 23:57:27
合計ジャッジ時間 1,526 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
4,348 KB
testcase_01 AC 41 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:19:14: 警告: ‘odd’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |     if (even * odd == 0){
      |         ~~~~~^~~~~
main.cpp:7:18: 備考: ‘odd’ はここで定義されています
    7 |     int n, even, odd;
      |                  ^~~
main.cpp:19:14: 警告: ‘even’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |     if (even * odd == 0){
      |         ~~~~~^~~~~
main.cpp:7:12: 備考: ‘even’ はここで定義されています
    7 |     int n, even, odd;
      |            ^~~~

ソースコード

diff #

#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;
}
0