已经派排除过范文退格了,变量也已经都开ll了,但是还是过不去。从WA的点来看应该是四舍五入部分出的问题(总是偏小),各位能帮忙看一下吗
#include <bits/stdc++.h>
using namespace std;
const int R = 1e4 + 10;
string a[R], b[R];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string s;
long long n = 0, m = 0, i, tme, res = 0;
while (true)
{
getline(cin, s);
if (s == "EOF")
{
break;
}
++n;
for (char c : s)
{
if (c == '<' && !a[n].empty())
{
a[n].pop_back();
}
else
{
a[n] += c;
}
}
}
while (true)
{
getline(cin, s);
if (s == "EOF")
{
break;
}
++m;
for (char c : s)
{
if (c == '<' && !b[m].empty())
{
b[m].pop_back();
}
else
{
b[m] += c;
}
}
for (i = 0; i < min(a[m].size(), b[m].size()); ++i)
{
res += (a[m][i] == b[m][i]);
}
}
cin >> tme;
cout << round(res * 60.0 / double(tme)) << '\n';
return 0;
}