結果

問題 No.2021 Not A but B
ユーザー dangodango
提出日時 2023-06-16 20:29:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 173 bytes
コンパイル時間 861 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 76,500 KB
最終ジャッジ日時 2023-09-06 17:48:24
合計ジャッジ時間 4,795 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,384 KB
testcase_01 AC 63 ms
71,320 KB
testcase_02 AC 60 ms
71,356 KB
testcase_03 AC 60 ms
71,444 KB
testcase_04 AC 60 ms
71,364 KB
testcase_05 AC 61 ms
71,388 KB
testcase_06 AC 60 ms
71,332 KB
testcase_07 AC 59 ms
71,364 KB
testcase_08 AC 70 ms
76,384 KB
testcase_09 AC 71 ms
76,360 KB
testcase_10 AC 67 ms
76,240 KB
testcase_11 AC 70 ms
76,308 KB
testcase_12 AC 68 ms
76,072 KB
testcase_13 AC 70 ms
76,448 KB
testcase_14 AC 69 ms
76,428 KB
testcase_15 AC 66 ms
76,408 KB
testcase_16 AC 67 ms
76,348 KB
testcase_17 AC 68 ms
76,152 KB
testcase_18 AC 70 ms
76,500 KB
testcase_19 AC 67 ms
76,400 KB
testcase_20 AC 71 ms
76,216 KB
testcase_21 AC 67 ms
76,104 KB
testcase_22 AC 64 ms
76,168 KB
testcase_23 AC 65 ms
75,980 KB
testcase_24 AC 65 ms
75,836 KB
testcase_25 AC 63 ms
75,700 KB
testcase_26 AC 64 ms
76,332 KB
testcase_27 AC 64 ms
76,244 KB
testcase_28 AC 67 ms
76,240 KB
testcase_29 AC 64 ms
76,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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