結果
問題 |
No.2021 Not A but B
|
ユーザー |
![]() |
提出日時 | 2022-07-29 22:11:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 329 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 73,340 KB |
最終ジャッジ日時 | 2024-07-19 15:00:25 |
合計ジャッジ時間 | 2,590 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
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 print(ans)