#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <map>
#include <iomanip>
#define INF 0x3f3f3f3f
#define pi acos(-1)
#define M 110
using namespace std;
typedef long long ll;
using namespace std;
const int maxn = 101;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
double t[maxn], wait[maxn], ans, sum;
string str;
cin >> n;
for (int i = 0; i < 4; i++) {
ans = 0;
int vis[maxn] = {0};
cin >> str;
for (int i = 0; i < n; i++) {
if (str[i] == '.') t[i] = 1, wait[i] = 0;
if (str[i] == 'w') t[i] = 2, wait[i] = 0;
if (str[i] == '>') {
vis[i] = 1;
t[i] = 1;
wait[i] = 0;
//cout << "i=" << i << endl;
}
if (str[i] == 's') wait[i] = 1, t[i] = 1;
if (str[i] == 'm') wait[i] = 2, t[i] = 1;
}
for (int i = 0; i < n; i++) {
if (vis[i]) {
double cnt = 0;
for (int j = 0; j < n-i; j++) {
if (j && vis[i + j]) {
break;
} else {
cnt += wait[i + j];
if (cnt >= 5) break;
t[i + j] /= 2;
if (cnt == 4.5 && str[i + j] == 'w') {
t[i + j] = 1.5;
}
cnt += t[i + j];
}
}
}
}
for (int i = 0; i < n; i++) {
ans += t[i] + wait[i];
//cout << "i=" << i << " " << "t[i]=" << t[i] << " " << "wait[i]=" << wait[i] << endl;
}
cout << fixed << setprecision(1) << ans << " ";
}
cout << endl;
}
也是水题,模拟的思想。
没什么好说的。