样例过了,但是有4个RE,6个WA
查看原帖
样例过了,但是有4个RE,6个WA
992565
daweli楼主2024/9/19 13:14
#include<bits/stdc++.h>
using namespace std;
string s;
char c;
int x,y,x2,y2,num,len;
int main(){
	while(cin>>c&&c!='E')
		s[num++]=c;
	len=num;
	num=0;
	for(int i=0;i<len;i++){
		if(s[i]=='W')
			x++;
		else y++;
		if((x>=11||y>=11)&&abs(x-y)>=2||i==len-1){
			cout<<x<<':'<<y<<endl;
			x=0;
			y=0;
		}
	}
	cout<<endl<<endl;
	for(int i=0;i<len;i++){
		if(s[i]=='W')
			x2++;
		else y2++;
		//cout<<x2<<' '<<y2<<endl;
		if(((x2>=21||y2>=21)&&abs(x2-y2)>=2)||i==len-1){
			cout<<x2<<':'<<y2<<endl;
			x2=0;
			y2=0;
		}
	}
	return 0;
}
2024/9/19 13:14
加载中...