求助
查看原帖
求助
194756
dino楼主2021/12/12 17:00
#include<bits/stdc++.h>
using namespace std;

int const N = 25 * 2500 + 5;
bool a[N];
int main()
{
	int n = 0;
	char s;
	while(cin >> s)
	{
		if(s == 'W') a[++n] = 0;
		if(s == 'L') a[++n] = 1;
		if(s == 'E') break;
	}
	int t = 0, u = 0;
	for(int i = 1; i <= n; i++)
	{
		if(a[i] == 0) t++;
		if(a[i] == 1) u++;
		if(t > 11 || u > 11) 
		{
			if(abs(t - u) >= 2)
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
		} 
		if(t == 11 && u < 11) 
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
			if(t < 11 && u == 11) 
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
	}
	cout << t << ":" << u << endl;
	cout << endl;
	t = 0;
	u = 0;
	for(int i = 1; i <= n; i++)
	{
		if(a[i] == 0) t++;
		if(a[i] == 1) u++;
		if(t > 21 || u > 21) 
		{
			if(abs(t - u) >= 2)
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
			
		}
		 if(t == 21 && u < 21) 
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
			if(t < 21 && u == 21) 
			{
				cout << t << ":" << u << endl;
				t = 0;
				u = 0;
			}
	}
	cout << t << ":" << u << endl;
}
2021/12/12 17:00
加载中...