记忆化搜索

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;
}
上一篇:拆分(回溯)


下一篇:TCP握手图解