算法贴这,20分,编译错误和答案错误...?
#include<iostream>
using namespace std;
char a[2510];
int main()
{
int i=0;
while(1)
{
cin>>a[i];
if(a[i]=='E')
{
break;
}
i++;
}
int l=0;
int w=0;
int e=0;
for(int c=0;c<=i;c++)
{
if(a[c]=='W')
{
w++;
}
else if(a[c]=='L')
{
l++;
}
if((w>=11||l>=11)&&(max(w,l)-min(w,l))>2)
{
e=w%11+l%11;
cout<<w<<":"<<l<<endl;
w=l=0;
}
}
if(i%11-e>0)
{
cout<<w<<":"<<l<<endl;
}
cout<<endl;
l=0;
w=0;
e=0;
for(int c=0;c<=i;c++)
{
if(a[c]=='W')
{
w++;
}
else if(a[c]=='L')
{
l++;
}
if((w>=21||l>=21)&&(max(w,l)-min(w,l))>2)
{
e=w%21+l%21;
cout<<w<<":"<<l<<endl;
w=l=0;
}
}
if(i%21-e>0)
{
cout<<w<<":"<<l<<endl;
}
return 0;
}