/ Vijos / 讨论 / 问答 /

乒乓球答疑

#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int i=1,j=1,w1sum,l1sum,wsum;
char s[1000];
int main()
{
while((s[i]=getchar())!='\n')
i++;
i--;
do
{
if (j>i)
{
break;
}
if (s[j]=='W')

{

w1sum+=1; if (w1sum==11&&w1sum-l1sum>=2)
{ cout<<11<<':'<<l1sum<<endl;
w1sum=0;
l1sum=0;
}
}
if (s[j]=='L')
{
l1sum+=1; if (l1sum==11&&l1sum-w1sum>=2)
{
cout<<w1sum<<':'<<11<<endl;;
w1sum=0;
l1sum=0;
}

}
j+=1;
if (s[j]=='E') break;
}
while(s[j]!='E');

if (w1sum>0||l1sum>0)
cout<<w1sum<<':'<<l1sum<<endl;
w1sum=0;
l1sum=0;
j=0;
cout<<" "<<endl;
do
{
if (j>i)
{
break;
}
if (s[j]=='W')

{

w1sum+=1; if (w1sum==21&&w1sum-l1sum>=2)
{ cout<<21<<':'<<l1sum<<endl;
w1sum=0;
l1sum=0;
}
}
if (s[j]=='L')
{
l1sum+=1; if (l1sum==21&&l1sum-w1sum>=2)
{
cout<<w1sum<<':'<<21<<endl;
w1sum=0;
l1sum=0;
}

}
j+=1;
if (s[j]=='E') break;
}
while(s[j]!='E');
if (w1sum>0||l1sum>0)
cout<<w1sum<<':'<<l1sum<<endl;
w1sum=0;
l1sum=0;
}
我想知道哪里错了

0 条评论

目前还没有评论...