题解 | 躲藏
躲藏
https://www.nowcoder.com/practice/b19eda9490d54505a1065a70c3005b47
#include<bits/stdc++.h>
#include <string>
using namespace std;
#define int long long
#define x first
#define y second
#define space ' '
#define endl '\n'
#define pb push_back
#define all(x) x.begin(),x.end()
#define debug(x) x<<' '
typedef pair<int,int> PII;
const int N=2e5+10;
const int INF=0x3f3f3f3f3f3f3f3fLL;
const int inf=0x3f3f3f3f3f3f3f3fLL;
const int mod=2000120420010122;
const int MOD=998244353;
int n,m,k,q;
string s;
void solve(){
string s;
while(cin>>s){
int ans=0;
int dp0=0,dp1=0,dp2=0;
for(auto pr:s){
if(pr=='w'||pr=='W') dp1+=dp0;
if(pr=='b'||pr=='B') dp2+=dp1;
if(pr=='c'||pr=='C') {
ans+=dp2;
dp0++;
}
}
cout<<ans%mod<<endl;
}
}
signed main(){
// double start=(double)clock()/CLOCKS_PER_SEC;
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout<<fixed<<setprecision(3);
int t=1;
// cin>>t;
while(t--){
solve();
}
// double end=(double)clock()/CLOCKS_PER_SEC;
// cout<<endl<<"time="<<end-start<<endl;
return 0;
}
