60分4RE,小蒟蒻求助
查看原帖
60分4RE,小蒟蒻求助
524085
yanbinmu楼主2022/11/5 19:34
#include <bits/stdc++.h>
using namespace std;
string s; 
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	char t;
	int x=0,y=0,a=1;
	cin>>t;
	while(t!='E'){
		s[a++] = t;
		if(t=='W') x++;
		if(t=='L') y++;
		if((x>=11 || y>=11) && abs(x-y)>=2){
			printf("%d:%d\n",x,y);
			x=0;
			y=0;
		}
		cin>>t;
	}
	printf("%d:%d\n\n",x,y);	
	x = 0;
	y = 0;
	for(int i = 1;i<a;i++){
		if(s[i]=='W') x++;
		if(s[i]=='L') y++;
		if((x>=21 || y>=21) && abs(x-y)>=2){
			printf("%d:%d\n",x,y);
			x=0;
			y=0;
		}
	}
	printf("%d:%d\n",x,y);
	return 0;
}

哪里错了?

2022/11/5 19:34
加载中...