Solution
2023-07-18 09:27:53
发布于:广东
12阅读
0回复
0点赞
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
string S;
cin >> N >> S;
long long NC = 0;
long long NO = 0;
long long NW = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'C') {
NC++;
} else if (S[i] == 'O') {
NO += NC;
} else if (S[i] == 'W') {
NW += NO;
}
}
cout << NW << endl;
return 0;
}
这里空空如也
有帮助,赞一个