0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-23 22:12:00 +00:00

P5587 打字练习

R43068622
This commit is contained in:
Baoshuo Ren 2020-12-03 07:39:36 +08:00 committed by Baoshuo Ren
parent cca58e92f2
commit 4f96b7d8eb
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

37
problem/P5587/P5587.cpp Normal file
View File

@ -0,0 +1,37 @@
#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;
}