結果
問題 | No.559 swapAB列 |
ユーザー |
![]() |
提出日時 | 2017-09-02 16:40:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 132 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-06 18:35:43 |
合計ジャッジ時間 | 1,300 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
n=input() i=0 j=len(n)-1 ans=0 while i<j: while n[i]!='B'and i<j:i+=1 while n[j]!='A'and i<j:j-=1 ans+=j-i i+=1 j-=1 print(ans)