結果

問題 No.2021 Not A but B
ユーザー EguyEguy
提出日時 2022-07-29 21:42:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 79,612 KB
最終ジャッジ日時 2023-09-26 20:12:54
合計ジャッジ時間 4,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,988 KB
testcase_01 AC 73 ms
71,180 KB
testcase_02 AC 72 ms
71,100 KB
testcase_03 AC 70 ms
70,824 KB
testcase_04 AC 73 ms
71,256 KB
testcase_05 AC 75 ms
71,220 KB
testcase_06 AC 71 ms
71,068 KB
testcase_07 AC 72 ms
71,212 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 86 ms
79,208 KB
testcase_28 AC 88 ms
79,092 KB
testcase_29 AC 87 ms
79,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
sys.setrecursionlimit(1000000)
INF = 1 << 100
#mod = 1000000007
mod = 998244353
input = lambda: sys.stdin.readline().rstrip()
li = lambda: list(map(int, input().split()))

N = int(input())
S = list(input())
ans = N-1

for i in range(1, N-1):
    if S[i-1] == S[i+1] == 'B':
        ans -= 1

flg = 0
for i in range(N-1):
    if S[i] == S[i+1] == 'B':
        ans -= 1
        flg = 1

print(ans + flg)
0