其他分享
首页 > 其他分享> > 记忆化搜索

记忆化搜索

作者:互联网

COW

#include<iostream>

using namespace std;

int main(){
    long long int c,o,w;
    c = o = w = 0;
    int n;
    string alls;

    cin >> n >> alls;

    for(auto i : alls){
        if(i == 'C') c ++;
        if(i == 'O') o += c;
        if(i == 'W') w += o;
    }

    cout << w;
}

标签:std,string,int,long,alls,记忆,搜索,main
来源: https://www.cnblogs.com/Xuuxxi/p/15834315.html