robin88 • 4个月前
using namespace std; / run this program using the console pauser or add your own getch, system("pause") or input loop / void score(char(&a)[65000],int num, int i) {
int w=0,l=0;
for(int j=0;j<i;j++)
{
if(a[j]=='W')
{
w++;
}
if(a[j]=='L')
{
l++;
}
if((w>=num || l>=num) && abs(w-l)>=2)
{
cout<<w<<':'<<l<<endl;
w=0;
l=0;
}
}
cout<<w<<':'<<l<<endl;
}
int main(int argc, char** argv) {
char a[65000]={};
int i=0;
while (true)
{
i++;
cin>>a[i];
if(a[i]=='E')
{
break;
}
}
score(a,11,i);
cout<<endl;
score(a,21,i);
return 0;
}
评论:
请先登录,才能进行评论