結果

問題 No.2021 Not A but B
ユーザー nohakai3nohakai3
提出日時 2022-07-30 10:57:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 8,572 KB
最終ジャッジ日時 2023-09-27 12:51:21
合計ジャッジ時間 3,483 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,812 KB
testcase_01 AC 12 ms
7,804 KB
testcase_02 AC 13 ms
7,812 KB
testcase_03 AC 13 ms
7,808 KB
testcase_04 AC 13 ms
7,720 KB
testcase_05 AC 13 ms
7,804 KB
testcase_06 AC 14 ms
7,868 KB
testcase_07 AC 13 ms
7,812 KB
testcase_08 AC 105 ms
8,468 KB
testcase_09 AC 106 ms
8,476 KB
testcase_10 AC 107 ms
8,460 KB
testcase_11 AC 103 ms
8,544 KB
testcase_12 AC 103 ms
8,456 KB
testcase_13 AC 108 ms
8,436 KB
testcase_14 AC 109 ms
8,568 KB
testcase_15 AC 109 ms
8,440 KB
testcase_16 AC 104 ms
8,448 KB
testcase_17 AC 101 ms
8,448 KB
testcase_18 AC 108 ms
8,572 KB
testcase_19 AC 108 ms
8,456 KB
testcase_20 AC 112 ms
8,460 KB
testcase_21 AC 19 ms
7,784 KB
testcase_22 AC 15 ms
7,820 KB
testcase_23 AC 15 ms
7,748 KB
testcase_24 AC 14 ms
7,828 KB
testcase_25 AC 16 ms
7,916 KB
testcase_26 AC 66 ms
8,472 KB
testcase_27 AC 120 ms
8,432 KB
testcase_28 AC 116 ms
8,544 KB
testcase_29 AC 125 ms
8,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input()


if "BB" in s:
    ans=1
else:
    ans=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