結果
| 問題 | No.2021 Not A but B |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-04-02 02:53:07 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| コード長 | 246 bytes |
| 記録 | |
| コンパイル時間 | 229 ms |
| コンパイル使用メモリ | 85,316 KB |
| 実行使用メモリ | 80,512 KB |
| 最終ジャッジ日時 | 2026-04-17 00:09:23 |
| 合計ジャッジ時間 | 3,285 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
N = int(input())
S = input()
ans = 0
for i in range(1, N):
a, b = S[i-1], S[i]
if a == b == 'B': continue
if a == 'A' and b == 'B':
if i-2 >= 0 and S[i-2] == 'B': continue
ans += 1
if 'BB' in S:
ans += 1
print(ans)
norioc