玄关!各位大佬帮忙看一下代码
查看原帖
玄关!各位大佬帮忙看一下代码
917823
jingwenhan楼主2024/8/14 13:45
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char c;
string b;
int ent1=0,ent2=0,ent=1;
int main(){
	cin>>c;
	if(c=='E'){
		cout<<"0:0"<<endl<<endl<<"0:0";
		return 0;
	}
	while(c!='E'){
		b[ent]=c;
		ent++;
		cin>>c;
	}
//	cout<<b[ent-1];
	for(int i=1;i<=ent-1;i++){
		if(b[i]=='W'){
			ent1++;
			if(ent1==11&&ent1-ent2>=2){
				cout<<ent1<<":"<<ent2<<endl;
				ent1=0; ent2=0;
			}
		}
		if(b[i]=='L'){
			ent2++;
			if(ent2==11&&ent2-ent1>=2){
				cout<<ent1<<":"<<ent2<<endl;
				ent1=0; ent2=0;
			}
		}
	}
	cout<<ent1<<":"<<ent2<<endl;
	ent1=0;
	ent2=0;
	cout<<endl<<endl;
	for(int i=1;i<=ent-1;i++){
		if(b[i]=='W'){
			ent1++;
			if(ent1==21&&ent1-ent2>=2){
				cout<<ent1<<":"<<ent2<<endl;
				ent1=0; ent2=0;
			}
		}
		if(b[i]=='L'){
			ent2++;
			if(ent2==21&&ent2-ent1>=2){
				cout<<ent1<<":"<<ent2<<endl;
				ent1=0; ent2=0;
			}
		}
	}
	cout<<ent1<<":"<<ent2<<endl;
	return 0;
}
2024/8/14 13:45
加载中...