結果

問題 No.2021 Not A but B
ユーザー 👑 NachiaNachia
提出日時 2022-07-29 21:36:36
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,624 KB
実行使用メモリ 12,936 KB
最終ジャッジ日時 2023-09-26 19:47:11
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,864 KB
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 15 ms
7,780 KB
testcase_03 AC 15 ms
7,832 KB
testcase_04 AC 15 ms
7,888 KB
testcase_05 AC 15 ms
7,828 KB
testcase_06 AC 15 ms
7,812 KB
testcase_07 AC 16 ms
7,736 KB
testcase_08 AC 48 ms
10,620 KB
testcase_09 AC 47 ms
10,656 KB
testcase_10 AC 48 ms
10,740 KB
testcase_11 AC 47 ms
10,456 KB
testcase_12 AC 47 ms
10,428 KB
testcase_13 AC 47 ms
10,656 KB
testcase_14 AC 48 ms
10,712 KB
testcase_15 AC 49 ms
10,664 KB
testcase_16 AC 48 ms
10,700 KB
testcase_17 AC 48 ms
10,432 KB
testcase_18 AC 48 ms
10,752 KB
testcase_19 AC 49 ms
10,696 KB
testcase_20 AC 49 ms
10,704 KB
testcase_21 AC 17 ms
7,812 KB
testcase_22 AC 17 ms
7,788 KB
testcase_23 AC 17 ms
7,860 KB
testcase_24 AC 16 ms
7,912 KB
testcase_25 AC 16 ms
7,808 KB
testcase_26 AC 53 ms
9,732 KB
testcase_27 AC 48 ms
12,936 KB
testcase_28 AC 48 ms
12,688 KB
testcase_29 AC 16 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

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