結果
問題 |
No.2021 Not A but B
|
ユーザー |
|
提出日時 | 2022-07-29 21:44:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 201 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 68,992 KB |
最終ジャッジ日時 | 2024-07-19 14:08:32 |
合計ジャッジ時間 | 2,615 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
N=int(input()) S=input() ans=0 cnt=-1 for i in range(N-1): if i+2<N and S[i]=="B" and S[i+1]=="A" and S[i+2]=="B": ans+=1 if S[i]==S[i+1]=="B": cnt+=1 print(N-1-max(0,cnt)-ans)