90分求助???
查看原帖
90分求助???
358377
momiji67楼主2023/12/2 09:45
#include<iostream>
using namespace std;
int main(){
	char s;
	int a[100005],t=0;
	while(s!='E'){
		cin>>s;
		if(s=='E')break;
		if(s=='W')a[t]=1;
		else a[t]=0;
		t++;
	}
	int w=0,l=0;
	for(int i=0;i<t;i++){
		if(w>=11||l>=11){
			if((w>l&&w-l>=2)||(w<l&&l-w>=2)){
				cout<<w<<':'<<l<<endl;
				w=0;l=0;
			}
		}
		if(a[i]==1)w++;
		else l++;
	}
	cout<<w<<':'<<l<<endl<<endl;
	w=0;l=0;
	for(int i=0;i<t;i++){
		if(w>=21||l>=21){
			if((w>l&&w-l>=2)||(w<l&&l-w>=2)){
				cout<<w<<':'<<l<<endl;
				w=0;l=0;
			}
		}
		if(a[i]==1)w++;
		else l++;
	}
	cout<<w<<':'<<l<<endl;
	return 0;
}
2023/12/2 09:45
加载中...