結果
| 問題 | No.2021 Not A but B |
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-07-29 22:33:32 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| + 316µs | |
| コード長 | 354 bytes |
| 記録 | |
| コンパイル時間 | 886 ms |
| コンパイル使用メモリ | 95,264 KB |
| 実行使用メモリ | 86,400 KB |
| 最終ジャッジ日時 | 2026-08-18 18:24:20 |
| 合計ジャッジ時間 | 4,614 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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