結果

問題 No.2021 Not A but B
ユーザー GrayCoderGrayCoder
提出日時 2022-07-29 23:27:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2023-09-26 23:14:28
合計ジャッジ時間 3,250 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,892 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,784 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 WA -
testcase_06 AC 15 ms
7,824 KB
testcase_07 AC 15 ms
7,784 KB
testcase_08 AC 78 ms
8,556 KB
testcase_09 AC 78 ms
8,576 KB
testcase_10 AC 79 ms
8,592 KB
testcase_11 AC 76 ms
8,520 KB
testcase_12 AC 77 ms
8,512 KB
testcase_13 AC 78 ms
8,524 KB
testcase_14 AC 78 ms
8,484 KB
testcase_15 AC 76 ms
8,476 KB
testcase_16 AC 77 ms
8,568 KB
testcase_17 AC 76 ms
8,460 KB
testcase_18 AC 79 ms
8,600 KB
testcase_19 AC 79 ms
8,484 KB
testcase_20 AC 79 ms
8,596 KB
testcase_21 AC 19 ms
7,856 KB
testcase_22 AC 18 ms
7,888 KB
testcase_23 AC 18 ms
7,868 KB
testcase_24 AC 16 ms
7,952 KB
testcase_25 AC 18 ms
7,912 KB
testcase_26 WA -
testcase_27 AC 85 ms
8,448 KB
testcase_28 AC 85 ms
8,604 KB
testcase_29 AC 87 ms
8,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


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

    ans = "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