結果

問題 No.2021 Not A but B
ユーザー GrayCoderGrayCoder
提出日時 2022-07-29 23:41:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 8,628 KB
最終ジャッジ日時 2023-09-26 23:33:08
合計ジャッジ時間 3,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,832 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 15 ms
7,772 KB
testcase_03 AC 16 ms
7,748 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 16 ms
7,880 KB
testcase_08 AC 79 ms
8,432 KB
testcase_09 AC 78 ms
8,448 KB
testcase_10 AC 77 ms
8,476 KB
testcase_11 AC 77 ms
8,536 KB
testcase_12 AC 77 ms
8,608 KB
testcase_13 AC 76 ms
8,576 KB
testcase_14 AC 78 ms
8,552 KB
testcase_15 AC 77 ms
8,384 KB
testcase_16 AC 77 ms
8,612 KB
testcase_17 AC 76 ms
8,552 KB
testcase_18 AC 79 ms
8,628 KB
testcase_19 AC 79 ms
8,552 KB
testcase_20 AC 79 ms
8,504 KB
testcase_21 AC 19 ms
7,784 KB
testcase_22 AC 18 ms
7,744 KB
testcase_23 AC 17 ms
7,776 KB
testcase_24 AC 17 ms
7,876 KB
testcase_25 AC 18 ms
7,816 KB
testcase_26 AC 48 ms
8,532 KB
testcase_27 AC 85 ms
8,428 KB
testcase_28 AC 83 ms
8,448 KB
testcase_29 AC 88 ms
8,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def main():
    input = lambda: sys.stdin.readline()[:-1]
    N = int(input())
    S = "_" + input()

    ans = int("BB" in S)
    for i in range(1, N):
        if S[i : i + 2] == "BB" or S[i - 1 : i + 2] == "BAB":
            continue
        ans += 1

    print(ans)


if not __debug__:
    f = open(sys.argv[1], "r")
    sys.stdin = f

main()
0