求助10分
查看原帖
求助10分
529038
Butterfly__qwq楼主2021/12/5 11:00
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int to=0;
	int h=0,o=0;
	char k;
	string p="";
    while(1)
	{
		cin>>k;
		if(k=='E')
		{

			cout<<h<<':'<<o<<endl;
			break;
		}
		if(k=='W')h++;
		if(k=='L')o++;
		if((h==11||o==11)&&abs(h-o)>=2)
		{
			cout<<h<<':'<<o<<endl;
			h=0;
			o=0;
		}
		p+=k;
	} 
	h=0;
	o=0;
	cout<<endl;
	while(1)
	{
		if(p[to]=='E')
		{
			cout<<h<<':'<<o<<endl;
			break;
		}
		if(p[to]=='W')h++;
		if(p[to]=='L')o++;
		if((h==21||o==21)&&abs(h-o)>=2)
		{
			cout<<h<<':'<<o<<endl;
			h=0;
			o=0;
		}
		to++;
	}
	return 0;
}
2021/12/5 11:00
加载中...