結果
問題 | No.2021 Not A but B |
ユーザー |
|
提出日時 | 2022-07-29 22:00:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 73,188 KB |
最終ジャッジ日時 | 2024-07-19 14:43:17 |
合計ジャッジ時間 | 2,529 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
n = int(input())S = input()ans = 0if "BB" in S:ans += 1S = S.split("B")lS = len(S)for i in range(len(S)):s = len(S[i])if s == 0:continueif i == 0:if i != lS-1:ans += selse:ans += s-1elif i == lS-1:ans += selse:if s == 1:ans += 1else:ans += s+1print(ans)