結果
問題 | No.559 swapAB列 |
ユーザー |
![]() |
提出日時 | 2017-08-25 22:22:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 990 bytes |
コンパイル時間 | 1,348 ms |
コンパイル使用メモリ | 158,684 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 15:53:17 |
合計ジャッジ時間 | 1,723 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <ctime>#include <cassert>#include <string>#include <algorithm>#include <vector>#include <queue>#include <stack>#include <functional>#include <iostream>#include <map>#include <set>#include <cassert>#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int,int> P;typedef pair<int,P> P1;typedef pair<P,P> P2;#define pu push#define pb push_back#define mp make_pair#define eps 1e-7#define INF 1000#define mod 1000000007#define fi first#define sc second#define rep(i,x) for(int i=0;i<x;i++)#define SORT(x) sort(x.begin(),x.end())#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())string s;int main(){cin >> s;int ans=0,cnt=0;for(int i=0;i<s.size();i++){if(s[i]=='B')cnt++;else ans+=cnt;}cout << ans << endl;}