結果

問題 No.2021 Not A but B
ユーザー 👑 Nachia
提出日時 2022-07-29 21:36:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-07-19 13:40:08
合計ジャッジ時間 2,617 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

input()
Sraw = input()
S = Sraw.split('B')
res = 0
for s in S :
  if len(s) == 0 : res += 0
  elif len(s) == 1 : res += 1
  else : res += len(s) + 1
if len(S[0]) >= 2 : res -= 1
if len(S[-1]) >= 2 : res -= 1
if Sraw.find("BB") != -1 : res += 1
print(res)
0