0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 16:58:48 +00:00
OI-codes/Luogu/P5587/P5587.cpp

36 lines
913 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();
2021-11-19 09:01:13 +00:00
} else {
2020-12-02 23:39:36 +00:00
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();
2021-11-19 09:01:13 +00:00
} else {
2020-12-02 23:39:36 +00:00
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;
}