結果

問題 No.2021 Not A but B
ユーザー U SU S
提出日時 2022-07-29 22:22:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,436 bytes
コンパイル時間 821 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 81,172 KB
最終ジャッジ日時 2023-09-26 21:38:38
合計ジャッジ時間 5,722 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
73,856 KB
testcase_01 AC 107 ms
74,180 KB
testcase_02 AC 107 ms
74,084 KB
testcase_03 AC 107 ms
73,728 KB
testcase_04 AC 105 ms
73,824 KB
testcase_05 AC 107 ms
73,800 KB
testcase_06 AC 110 ms
73,880 KB
testcase_07 AC 107 ms
73,876 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 139 ms
80,736 KB
testcase_28 AC 137 ms
81,000 KB
testcase_29 AC 134 ms
81,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# sys.setrecursionlimit(10**7)
# input = sys.stdin.readline
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def mps(A):return [tuple(map(str, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def atoi(LIST): return [ord(i)-ord("a") for i in LIST]
def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate, product
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e18)+20
mod = int(1e9+7)

n = int(input())
s = input()
if n == 2:
    print(1)
    exit()
ans = n-1
for i in range(n-2):
    u = []
    for j in range(3):
        u.append(s[i+j])
    u = "".join(u)
    if u == "BAB":ans -= 1
if s.count("BB") >= 1:
    t = s.count("BB")-1
else:t = 0
print(ans-t)
# ans = 0
# if n == 2:
#     u = set()
#     u.add(s)
#     u.add("BB")
#     print(len(u))
#     exit()
# s = "A"+s+"A"
# pre = list(s[:4])
# for i in range(len(s)-3):
#     now = []
#     for j in range(4):
#         now.append(s[i+j])
#     now[1] = "B"
#     now[2] = "B"
#     if pre[1:] != now[1:]:ans += 1
#     pre =

0