結果
| 問題 | No.582 キャンディー・ボックス3 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-02 16:35:21 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 615 bytes |
| 記録 | |
| コンパイル時間 | 4,132 ms |
| コンパイル使用メモリ | 73,484 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-02 16:35:30 |
| 合計ジャッジ時間 | 2,425 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
using namespace std;
int t, n;
int main() {
// freopen("game.in", "r", stdin);
// freopen("game.out", "w", stdout);
scanf("%d", &n);
int cnt1 = 0, cnt2 = 0;
bool cnt3 = false;
for (int i = 1, x; i <= n; ++i) {
scanf("%d", &x);
if (x == 1) ++cnt1;
else if (x == 2) ++cnt2;
else if (x >= 3) cnt3 = true;
}
if (n == 1) {
puts(cnt1 == 1 ? "A" : "B");
return 0;
}
if (cnt3 || cnt2 >= 2) puts("B");
else {
if (cnt2 == 1) cnt1 += 2;
puts(cnt1 % 2 ? "A" : "B");
}
return 0;
}