結果

問題 No.2022 Antilogarithm
コンテスト
ユーザー H3PO4
提出日時 2022-07-29 21:43:24
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 364 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 297 ms
コンパイル使用メモリ 21,540 KB
実行使用メモリ 20,844 KB
最終ジャッジ日時 2026-08-18 16:41:41
合計ジャッジ時間 16,846 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 62
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
S = input()
ans = 0
# AA→BB
for i in range(N - 1):
    if S[i:i + 2] == "AA":
        ans += 1

# A→B
for i in range(N):
    if S[i] == "A":
        if (0 <= i - 1 and S[i - 1] == "B") or (i + 1 < N and S[i + 1] == "B"):
            ans += 1
# 不変
for i in range(N - 1):
    if S[i:i + 2] == "BB":
        ans += 1
        break
print(ans)
0