求助,只有#8对了
查看原帖
求助,只有#8对了
1385625
AmikazeMinato楼主2024/10/3 16:03
#include<bits/stdc++.h>
using namespace std;
char s;
int a[1000001],b[1000001];
int c,d;
int main(){
	int t=0;
	while(1){
		cin>>s;
		if(s=='E'){
			break;
		}else if(s=='W'){
			a[t]++; 
		}else if(s=='L'){
			b[t]++;
		}
		t++;
	}
	for(int i = 0;i<t;i++){
		if(a[i]!=0){
			c++;
		}else{
			d++;
		}
		if(c>=11){
			cout<<c<<':'<<d<<endl;
			c=0;
			d=0;
		}else if(d>=11){
			cout<<c<<':'<<d<<endl;
			c=0;
			d=0;
		}	
	}
	if(c!=0&&d!=0){
		cout<<c<<':'<<d<<endl;
	}
	c=0;
	d=0; 
	cout<<endl;
	
	for(int i = 0;i<t;i++){
		if(a[i]!=0){
			c++;
		}else{
			d++;
		}
		if(c>=21){
			cout<<c<<':'<<d<<endl;
			c=0;
			d=0;
		}else if(d>=21){
			cout<<c<<':'<<d<<endl;
			c=0;
			d=0;
		}	
	}
	if(c!=0&&d!=0){
		cout<<c<<':'<<d<<endl;
	}
	c=0;
	d=0; 
	return 0;
}

2024/10/3 16:03
加载中...