0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-04 10:58:30 +00:00
OI-codes/Luogu/problem/P5587/P5587.cpp

38 lines
937 B
C++
Raw Normal View History

2020-12-02 23:39:36 +00:00
#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;
}