結果

問題 No.2021 Not A but B
ユーザー ikomaikoma
提出日時 2022-07-29 22:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 76,584 KB
最終ジャッジ日時 2023-09-26 22:27:32
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,448 KB
testcase_01 AC 75 ms
71,512 KB
testcase_02 AC 72 ms
71,108 KB
testcase_03 AC 74 ms
71,284 KB
testcase_04 AC 73 ms
71,244 KB
testcase_05 AC 74 ms
71,388 KB
testcase_06 AC 73 ms
71,136 KB
testcase_07 AC 72 ms
71,208 KB
testcase_08 AC 81 ms
76,188 KB
testcase_09 AC 81 ms
76,452 KB
testcase_10 AC 80 ms
76,300 KB
testcase_11 AC 81 ms
76,312 KB
testcase_12 AC 82 ms
76,256 KB
testcase_13 AC 83 ms
76,460 KB
testcase_14 AC 82 ms
76,420 KB
testcase_15 AC 83 ms
76,256 KB
testcase_16 AC 82 ms
76,256 KB
testcase_17 AC 83 ms
76,416 KB
testcase_18 AC 82 ms
76,584 KB
testcase_19 AC 79 ms
76,340 KB
testcase_20 AC 82 ms
76,492 KB
testcase_21 AC 80 ms
76,052 KB
testcase_22 AC 79 ms
75,812 KB
testcase_23 AC 76 ms
75,880 KB
testcase_24 AC 76 ms
76,024 KB
testcase_25 AC 77 ms
76,080 KB
testcase_26 AC 78 ms
76,260 KB
testcase_27 AC 81 ms
76,440 KB
testcase_28 AC 79 ms
76,308 KB
testcase_29 AC 80 ms
76,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
S=input().strip()
ans=1 if "BB" in S else 0
for i in range(1,N):
    if S[i-1:i+1]!="BB":
        if i==1 or S[i-2:i+1]!="BAB":
            ans+=1
print(ans)
0