結果
| 問題 | No.582 キャンディー・ボックス3 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-03 13:55:27 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 613 bytes |
| 記録 | |
| コンパイル時間 | 787 ms |
| コンパイル使用メモリ | 73,904 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-02-03 13:55:33 |
| 合計ジャッジ時間 | 2,716 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
using namespace std;
int n, one, two, three;
void Solve() {
one = two = 0;
scanf("%d", &n);
if (n == 1) {
int x;
scanf("%d", &x);
puts(x == 1 ? "A" : "B");
} else {
for (int i = 1, x; i <= n; ++i) {
scanf("%d", &x);
if (x == 1) ++one;
else if (x == 2) ++two;
else if (x >= 3) three = true;
}
if (three || two >= 2) puts("B");
else {
if (two == 1) one += 2;
puts(one % 2 ? "A" : "B");
}
}
}
int main() {
Solve();
return 0;
}