40分。。求助
查看原帖
40分。。求助
910982
Lhy153楼主2024/1/26 09:48
#include<bits/stdc++.h>
using namespace std;
string a;
int l,w,o[10086],p[10086],cnt,x,y,ans,o1[10086],p1[10086];
int main(){
	ios::sync_with_stdio(false);
	char u;
	while(cin>>u){
		if(u!='E') a+=u;
		else break;
	}
	if(a.empty()) cout<<"0:0"<<"\n"<<"\n"<<"0:0";
	for(int i=0;i<a.size();i++){
		if(a[i]=='W') w++,x++;
		else if(a[i]=='L') l++,y++;
		else if(a[i]=='E') break;
		if(l+w==11) o[cnt]=w,p[cnt]=l,w=0,l=0,cnt++;
		if(x+y==21) o1[ans]=x,p1[ans]=y,x=0,y=0,ans++;
	}
	for(int i=0;i<cnt;i++){
		cout<<o[i]<<":"<<p[i]<<"\n";
	}
	if(w!=0||l!=0) cout<<w<<":"<<l<<"\n"<<"\n";
	for(int i=0;i<ans;i++){
		cout<<o1[i]<<":"<<p1[i]<<"\n";
	}
	if(x!=0||y!=0) cout<<x<<":"<<y;
	return 0;
}
2024/1/26 09:48
加载中...