mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-30 16:36:26 +00:00
#130. 【2020.11.26 NOIP模拟赛 T4】非常困难的压轴题
https://sjzezoj.com/submission/17720
This commit is contained in:
parent
b82ff6f591
commit
e377cc14e3
18
S2OJ/130/130.cpp
Normal file
18
S2OJ/130/130.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user