結果

問題 No.2021 Not A but B
ユーザー kamomekamome
提出日時 2022-07-31 12:56:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-09-28 04:03:40
合計ジャッジ時間 3,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,840 KB
testcase_01 AC 13 ms
7,824 KB
testcase_02 AC 13 ms
7,824 KB
testcase_03 AC 14 ms
7,756 KB
testcase_04 AC 14 ms
7,824 KB
testcase_05 AC 14 ms
7,844 KB
testcase_06 AC 13 ms
7,932 KB
testcase_07 AC 12 ms
7,760 KB
testcase_08 AC 118 ms
8,256 KB
testcase_09 AC 124 ms
8,260 KB
testcase_10 AC 124 ms
8,368 KB
testcase_11 AC 114 ms
8,412 KB
testcase_12 AC 117 ms
8,352 KB
testcase_13 AC 120 ms
8,264 KB
testcase_14 AC 121 ms
8,416 KB
testcase_15 AC 118 ms
8,280 KB
testcase_16 AC 120 ms
8,316 KB
testcase_17 AC 113 ms
8,240 KB
testcase_18 AC 124 ms
8,336 KB
testcase_19 AC 119 ms
8,324 KB
testcase_20 AC 123 ms
8,404 KB
testcase_21 AC 19 ms
7,848 KB
testcase_22 AC 17 ms
7,776 KB
testcase_23 AC 17 ms
7,832 KB
testcase_24 AC 14 ms
7,924 KB
testcase_25 AC 17 ms
7,828 KB
testcase_26 AC 122 ms
8,416 KB
testcase_27 AC 121 ms
8,336 KB
testcase_28 AC 122 ms
8,412 KB
testcase_29 AC 118 ms
8,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

input()
S=input()
prev=""
Flag=False
if S[0:2]=="BB":
    c=1
    Flag=True
else:
    c=1
for i in range(1,len(S)-1):
    #print(S[i:i+2])
    if S[i:i+2]!="BB":
        c=c+1
    elif Flag==False:
        c=c+1
        Flag=True
    if S[i-1:i+2]=="BAB":
        #if FLAG==True:
        c=c-1

print(c)
0