結果

問題 No.582 キャンディー・ボックス3
コンテスト
ユーザー vjudge1
提出日時 2026-01-30 16:21:10
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 743 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,510 ms
コンパイル使用メモリ 183,900 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-01-30 16:21:14
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define int long long
using namespace std;
  
const int N = 150 + 5;
  
int T, n, c[N];
  
bool check()
{
    int cnt1 = 0, cnt2 = 0;
    for (int i = 1; i <= n; i++)
    {
        if (c[i] == 1)  cnt1++;
        else if (c[i] == 2) cnt2++;
        else if (c[i] != 0)   return false;
    }
    if (cnt2 == 1 && cnt1 % 2 == 1) return true;
    if (cnt2 == 0 && cnt1 % 2 == 1)  return true;
    return false;
}
  
void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    if (check())    cout << "A\n";
    else    cout << "B\n";
}
  
signed main()
{
    //freopen ("game.in", "r", stdin);
    //freopen ("game.out", "w", stdout);
    //cin >> T;
    //while (T--) 
solve();
    return 0;
}
0