結果

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

ソースコード

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