0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-24 16:48:49 +00:00
OI-codes/Luogu/problem/P5587/P5587.cpp
2021-01-02 15:30:52 +08:00

38 lines
937 B
C++

#include <bits/stdc++.h>
using namespace std;
long long n, m, ans;
string s[10005], r[10005], tmp;
int main() {
while (getline(cin, tmp), tmp != "EOF") {
n++;
for (long long i = 0; i < tmp.size(); i++) {
if (tmp[i] == '<') {
if (!s[n].empty()) s[n].pop_back();
}
else {
s[n].push_back(tmp[i]);
}
}
}
while (getline(cin, tmp), tmp != "EOF") {
if (++m > n) continue;
for (long long i = 0; i < tmp.size(); i++) {
if (tmp[i] == '<') {
if (!r[m].empty()) r[m].pop_back();
}
else {
r[m].push_back(tmp[i]);
}
}
for (long long i = 0; i < min(r[m].size(), s[m].size()); i++) {
if (r[m][i] == s[m][i]) ans++;
}
}
cin >> m;
cout << (int)(ans * 60.0 / m + 0.5) << endl;
return 0;
}