結果

問題 No.582 キャンディー・ボックス3
ユーザー face4
提出日時 2018-08-09 09:11:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 65,376 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-23 04:18:00
合計ジャッジ時間 1,196 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int n;
    cin >> n;

    int c[n];
    for(int i = 0; i < n; i++)  cin >> c[i];

    int two = 0, one = 0;
    bool judge = true;

    for(int i = 0; i < n; i++){
        if(c[i] > 2)    judge = false;
        else if(c[i] == 1)  one++;
        else if(c[i] == 2)  two++;
    }

    if(judge && one%2 == 1 && (two == 0 || two == 1)){
        cout << "A" << endl;
    }else{
        cout << "B" << endl;
    }

    return 0;
}
0