50分求改
查看原帖
50分求改
1088073
Axolotlwww楼主2024/10/13 00:48

源码:

#include<bits/stdc++.h>
using namespace std;

string s;

void f(int rad){
	int a,b,t;
	a=b=t=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='E') break;
		if(s[i]=='W') a++;
		else if(s[i]=='L') b++;
		t++;
		if(t>=rad&&abs(a-b)>=2){
			cout<<a<<":"<<b<<endl;
			a=b=t=0;
		}
	}
	if(a!=0||b!=0) cout<<a<<":"<<b<<endl;
	
	return;
}

int main(){
	string tmp;
	while(cin>>tmp) s+=tmp;
	if(s[0]=='E') cout<<"0:0\n\n0:0";
	f(11);
	cout<<endl;
	f(21);
	
	return 0;
}

2024/10/13 00:48
加载中...