题解 | 躲藏

躲藏

https://www.nowcoder.com/practice/b19eda9490d54505a1065a70c3005b47

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 0x3f3f3f3f3f3f3f3f;
const int mod=2000120420010122;
void solve(){
    string s;
    while(cin>>s){
        vector<int> dp(4);
        for(auto i:s){
            if(i=='c'||i=='C') dp[0]++,dp[3]=(dp[2]+dp[3])%mod;
            else if(i=='w'||i=='W') dp[1]+=dp[0];
            else if(i=='b'||i=='B') dp[2]+=dp[1];
        }
        cout<<dp[3]%mod<<"\n";
    }

}
signed main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }return 0;
}

全部评论

相关推荐

牛客49732338...:同志们,已拿下
我的OC时间线
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务