結果
問題 |
No.2276 I Want AC
|
ユーザー |
|
提出日時 | 2025-10-06 21:12:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 555 ms |
コンパイル使用メモリ | 82,644 KB |
実行使用メモリ | 76,160 KB |
最終ジャッジ日時 | 2025-10-06 21:12:57 |
合計ジャッジ時間 | 6,564 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 44 |
ソースコード
## https://yukicoder.me/problems/no/2276 def main(): N = int(input()) S = input() # 全てAにした時の回答 answer = 0 a_num = 0 for s in S: if s in ("A", "?"): a_num += 1 else: answer += a_num max_answer = answer c_num = 0 for s in S: if s == "?": a_num -= 1 answer -= c_num answer += a_num c_num += 1 elif s == "C": c_num += 1 max_answer = max(max_answer, answer) print(max_answer) if __name__ == "__main__": main()