为什么MLE了两个点,紧急求助
查看原帖
为什么MLE了两个点,紧急求助
469087
Tipsy_bamboo楼主2021/2/27 15:44
#include<bits/stdc++.h>
using namespace std;
string zf = "", sr;
long long xh, ds;
int main()
{
	cin >> sr;
	zf += sr;
	while(zf[zf.size() - 1] != 'E')
	{
		cin >> sr;
		zf += sr; 
	}
	for(int i = 0; i < zf.size(); i++)
	{
		if(zf[i] == 'W') xh += 1;
		if(zf[i] == 'L') ds += 1;
		if(xh >= 11 && xh - ds >= 2 || ds >= 11 && xh - ds >= 2 || xh >= 11 && ds - xh >= 2 || ds >= 11 && ds - xh >= 2)
		{
			cout << xh << ":" << ds << endl;
			xh = 0;
			ds = 0;
		}
	}
	if(xh > 0 || ds > 0) cout << xh << ":" << ds << endl << endl;
	xh = 0;
	ds = 0;
	for(int i = 0; i < zf.size(); i++)
	{
		if(zf[i] == 'W') xh += 1;
		if(zf[i] == 'L') ds += 1;
		if(xh >= 21 && xh - ds >= 2 || ds >= 21 && xh - ds >= 2 || xh >= 21 && ds - xh >= 2 || ds >= 21 && ds - xh >= 2)
		{
			cout << xh << ":" << ds << endl;
			xh = 0;
			ds = 0;
		}
	}
	if(xh > 0 || ds > 0) cout << xh << ":" << ds << endl;
	return 0;
}
2021/2/27 15:44
加载中...