大佬求助,不知道为什么过不了
查看原帖
大佬求助,不知道为什么过不了
1489423
chengqian233楼主2024/10/26 19:42
#include<iostream>
#include<string>
#include<cmath> 
using namespace std;
int main()
{   int i=0; int w=0,l=0;
    int j=0; int r=0,t=0;
  	string a; 
	cin>>a;
if(a[0]=='E')
cout<<"0:0";
while(a[i]!='E')
{
 if(a[i]=='W')
  w++;
  else
  l++;
 if((w>=11||l>=11)&&abs(w-l)>1)
 { 	
	cout<<w<<":"<<l<<'\n';
	w=0;l=0;
 }	
 else if(a[i+1]=='E')
   {
	 cout<<w<<":"<<l<<'\n';
   }    
	i++;
}
cout<<endl;
cout<<endl;
if(a[0]=='E')
cout<<"0:0";
while(a[j]!='E')
{
 if(a[j]=='W')
  r++;
  else
  t++;
 if((r>=21||t>=21)&&abs(r-t)>1)
 { 	
	cout<<r<<":"<<t<<'\n';
	r=0;t=0;
 }	
 else if(a[j+1]=='E')
   {
	 cout<<r<<":"<<t<<'\n';
   }    
	j++;
}
	return 0;
}

2024/10/26 19:42
加载中...