結果
| 問題 |
No.2021 Not A but B
|
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-07-29 22:33:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 354 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 81,988 KB |
| 実行使用メモリ | 73,088 KB |
| 最終ジャッジ日時 | 2024-07-19 15:44:29 |
| 合計ジャッジ時間 | 2,700 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
n=int(input())
s=list(input())
ans=0
f = 0
for i in range(n):
if i - 2 >= 0:
if s[i] == 'B' and s[i-2] == 'B' and s[i-1] == 'A':
ans -= 1
if i < n-1:
if s[i] == 'B' and s[i+1] == 'B':
if f==0:
ans+=1
f=1
else:
ans+=1
print(ans)
lllllll88938494