結果
問題 |
No.2021 Not A but B
|
ユーザー |
![]() |
提出日時 | 2023-01-17 22:52:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 2,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 573 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 72,448 KB |
最終ジャッジ日時 | 2025-01-03 02:54:40 |
合計ジャッジ時間 | 3,573 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
n = int(input()) s = input() s = list(s) if n == 2: print(1) exit() fra = 0 an = ["B","B",s[2]] ans = 1 if s[0] == "B" and s[1] == "B": fra = 1 for i in range(n-2): if s[i+1] == "B" and s[i+2] == "B": if fra == 0: fra = 1 else: continue if s[i] != "B" or s[i+2] != "B": ans += 1 print(ans)