50ptsWA求调
  • 板块P5587 打字练习
  • 楼主Bodhi
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/11/12 19:42
  • 上次更新2023/11/12 21:12:50
查看原帖
50ptsWA求调
364848
Bodhi楼主2023/11/12 19:42

已经派排除过范文退格了,变量也已经都开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;
}

2023/11/12 19:42
加载中...