結果
| 問題 |
No.2021 Not A but B
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2025-02-11 21:03:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 239 bytes |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 82,736 KB |
| 実行使用メモリ | 62,944 KB |
| 最終ジャッジ日時 | 2025-02-11 21:03:32 |
| 合計ジャッジ時間 | 2,422 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
N = int(input())
S = input()
ans = N - 1
cntBB = 0
cntBAB = 0
for i in range(N - 1):
if S[i:i + 2] == "BB":
cntBB += 1
if i < N - 2 and S[i:i + 3] == "BAB":
cntBAB += 1
ans -= max(0,cntBB-1)
ans -= cntBAB
print(ans)
ntuda