結果

問題 No.559 swapAB列
ユーザー sawa_tsuka
提出日時 2017-09-15 14:27:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 265 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 56,040 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 22:50:41
合計ジャッジ時間 1,032 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 3 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n=0,i=0,b=0;
    string s;
    cin>>s;
    for(auto c : s){
        if(c=='B'){
            n+=i;
            b++;
        }
        i++;
            
    }
    cout<<n-b*(b-1)/2;
}
0