結果
| 問題 |
No.2021 Not A but B
|
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-07-29 22:19:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 411 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 72,704 KB |
| 最終ジャッジ日時 | 2024-07-19 15:21:23 |
| 合計ジャッジ時間 | 2,791 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | AC * 1 WA * 25 |
ソースコード
n=int(input())
s=list(input())
ans=0
f = 0
for i in range(n):
if i < n-2:
if s[i] == 'B' and s[i+1] == 'B':
if f==0:
ans+=1
f=1
continue
ans+=1
if i - 2 >= 0:
if s[i] == 'B' and s[i-2] == 'B' and s[i-1] == 'A':
ans-=1
if s[i] == 'B' and s[i-2] == 'A' and s[i-1] == 'A':
ans-=1
print(ans)
lllllll88938494