結果

問題 No.2021 Not A but B
ユーザー ShirotsumeShirotsume
提出日時 2022-07-29 21:36:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 76,380 KB
最終ジャッジ日時 2023-09-26 19:49:00
合計ジャッジ時間 4,021 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,004 KB
testcase_01 AC 73 ms
71,116 KB
testcase_02 AC 73 ms
70,956 KB
testcase_03 AC 72 ms
71,144 KB
testcase_04 AC 74 ms
71,008 KB
testcase_05 AC 74 ms
71,088 KB
testcase_06 AC 75 ms
71,164 KB
testcase_07 AC 74 ms
71,164 KB
testcase_08 AC 86 ms
75,892 KB
testcase_09 AC 87 ms
76,304 KB
testcase_10 AC 85 ms
76,072 KB
testcase_11 AC 86 ms
76,208 KB
testcase_12 AC 84 ms
76,380 KB
testcase_13 AC 86 ms
76,252 KB
testcase_14 AC 85 ms
76,064 KB
testcase_15 AC 84 ms
76,100 KB
testcase_16 AC 85 ms
76,056 KB
testcase_17 AC 84 ms
75,996 KB
testcase_18 AC 86 ms
75,988 KB
testcase_19 AC 86 ms
76,352 KB
testcase_20 AC 85 ms
76,224 KB
testcase_21 AC 80 ms
75,848 KB
testcase_22 AC 80 ms
75,604 KB
testcase_23 AC 80 ms
75,600 KB
testcase_24 AC 77 ms
75,612 KB
testcase_25 AC 79 ms
75,608 KB
testcase_26 AC 79 ms
75,900 KB
testcase_27 AC 84 ms
76,268 KB
testcase_28 AC 83 ms
76,068 KB
testcase_29 AC 83 ms
75,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
n = ii()
s = input()

ans = 0
t = False
for i in range(n - 1):
    if s[i] + s[i + 1] == 'BB':
        t = True
    elif i < n - 2 and s[i] + s[i + 1] + s[i + 2] == 'BAB':
        pass
    else:
        ans += 1
print(ans + t)
0