0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:56:27 +00:00

#130. 【2020.11.26 NOIP模拟赛 T4】非常困难的压轴题

https://sjzezoj.com/submission/17720
This commit is contained in:
Baoshuo Ren 2021-08-16 17:12:58 +08:00 committed by Baoshuo Ren
parent b82ff6f591
commit e377cc14e3
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

18
S2OJ/130/130.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <bits/stdc++.h>
using namespace std;
long long l[150005], lw[150005], lws[150005];
string s;
int main() {
cin >> s;
s = ' ' + s;
for (int i = 1; i < s.size(); i++) {
l[i] = l[i - 1] + (s[i] == 'L');
lw[i] = lw[i - 1] + (s[i] == 'W') * l[i];
lws[i] = lws[i - 1] + (s[i] == 'S') * lw[i];
}
cout << lws[s.size() - 1] << endl;
return 0;
}