結果

問題 No.582 キャンディー・ボックス3
ユーザー lam6er
提出日時 2025-03-31 17:50:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 53,776 KB
最終ジャッジ日時 2025-03-31 17:52:01
合計ジャッジ時間 1,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
candies = list(map(int, input().split()))

count_k = 0  # number of boxes with exactly 1 candy
count_m = 0  # number of boxes with more than 1 candy

for c in candies:
    if c == 1:
        count_k += 1
    elif c > 1:
        count_m += 1

if count_m == 0:
    # All boxes are 0 or 1; only 1's matter
    if count_k % 2 == 1:
        print("A")
    else:
        print("B")
else:
    # At least one box with more than 1; parity of count_k determines outcome
    if count_k % 2 == 1:
        print("A")
    else:
        print("B")
0