60分求助,大佬能帮忙检查一下吗?
查看原帖
60分求助,大佬能帮忙检查一下吗?
531144
winson521楼主2022/12/13 08:23
#include<iostream> 
#include<cmath> 
#include<cstring> 
#include<string>
#include<map> 
#include<queue> 
#include<stack> 
#include<iomanip> 
#include<algorithm> 
#include<cstdio> 
using namespace std;
const long long N=25*2002;
char a[N];
int main()
{
	char tmpp;
	long long i=1;
	while (true)
	{
		 cin >>tmpp;
		 if(tmpp=='E')
		 {
		 	break;
		 }
		 else 
		 {
		 	a[i]=tmpp;
		 	i++;
		 }
	}
	long long j=1;
	int tmp1=0;
	int tmp2=0;
	while(j<=i)
	{ 
		if(a[j]=='W')
		{
			tmp1++;
		}
		if(a[j]=='L')
		{
			tmp2++;
		}
		if((tmp1==11||tmp2==11)&&(tmp1-tmp2>=2||tmp2-tmp1>=2))
		{
			cout <<tmp1<<":"<<tmp2<<endl;
			tmp1=0;
			tmp2=0;
		}
		j++;
	}
	cout <<tmp1<<":"<<tmp2<<endl;
	cout <<endl;
	j=1;
	tmp1=0;
	tmp2=0;
	while(j<=i)
	{
		if(a[j]=='W')
		{
			tmp1++;
		}
		if(a[j]=='L')
		{
			tmp2++;
		}
		if((tmp1==21||tmp2==21)&&(tmp1-tmp2>=2||tmp2-tmp1>=2))
		{
			cout <<tmp1<<":"<<tmp2<<endl;
			tmp1=0;
			tmp2=0;
		}
	j++;
	}
	cout <<tmp1<<":"<<tmp2<<endl;
	cout <<endl;
	return 0;
}
2022/12/13 08:23
加载中...