题解
2023-08-01 20:21:15
发布于:上海
35阅读
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;
}
全部评论 1
顶
2023-08-15 来自 江苏
0
有帮助,赞一个