結果

問題 No.2021 Not A but B
ユーザー prussian_coderprussian_coder
提出日時 2022-07-29 21:35:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 76,528 KB
最終ジャッジ日時 2023-09-26 19:35:30
合計ジャッジ時間 4,100 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,092 KB
testcase_01 AC 72 ms
71,296 KB
testcase_02 AC 71 ms
71,196 KB
testcase_03 AC 72 ms
71,172 KB
testcase_04 AC 73 ms
71,336 KB
testcase_05 AC 71 ms
71,336 KB
testcase_06 AC 73 ms
71,276 KB
testcase_07 AC 73 ms
71,236 KB
testcase_08 AC 87 ms
76,220 KB
testcase_09 AC 87 ms
76,220 KB
testcase_10 AC 86 ms
76,072 KB
testcase_11 AC 87 ms
76,216 KB
testcase_12 AC 87 ms
76,272 KB
testcase_13 AC 85 ms
76,204 KB
testcase_14 AC 86 ms
76,328 KB
testcase_15 AC 86 ms
76,528 KB
testcase_16 AC 85 ms
76,224 KB
testcase_17 AC 86 ms
76,240 KB
testcase_18 AC 86 ms
76,300 KB
testcase_19 AC 86 ms
76,336 KB
testcase_20 AC 86 ms
76,208 KB
testcase_21 AC 81 ms
75,900 KB
testcase_22 AC 79 ms
75,632 KB
testcase_23 AC 82 ms
75,844 KB
testcase_24 AC 78 ms
75,656 KB
testcase_25 AC 79 ms
75,980 KB
testcase_26 AC 81 ms
76,232 KB
testcase_27 AC 81 ms
76,176 KB
testcase_28 AC 82 ms
76,184 KB
testcase_29 AC 79 ms
76,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()
ans=0
f=0
for i in range(N-1):
	if S[i]=="B" and S[i+1]=="B":
		f=1
	else:
		ans+=1
for i in range(N-2):
	if S[i:i+3]=="BAB":
		ans-=1
print(ans+f)
0