結果

問題 No.559 swapAB列
ユーザー kyunakyuna
提出日時 2019-07-26 12:27:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 69,612 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-02 06:25:42
合計ジャッジ時間 1,135 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    string s; cin >> s;
    int cnt = 0, ans = 0;
    for (char c: s) {
        if (c == 'A') ans += cnt;
        if (c == 'B') cnt++;
    }
    cout << ans << endl;
    return 0;
}
0