# 谁能帮忙解释一下为啥有两个点有问题？

WrongAnswer, time = 45 ms, mem = 836 KiB, score = 80

c++
```
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
char a[100000];
int W=0,L=0;
int i=0;

while(1){
cin>>a[i];
if(a[i]=='E') break;
i++;
}
i=0;

while(1){
if(a[i]=='E'){
if(W>0 || L>0){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
break;
}
else{
cout<<endl;
break;
}
}
if(a[i]=='W') W++;
else if(a[i]=='L') L++;
if((W>=11 && abs(W-L)>=2 )||( L>=11 && abs(W-L)>=2)){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
}
i++;
}
i=0;
cout<<endl;
while(1){
if(a[i]=='E'){
if(W>0 || L>0){
cout<<W<<":"<<L<<endl;
break;
}
else{
cout<<endl;
break;
}
}
if(a[i]=='W') W++;
else if(a[i]=='L') L++;
if((W>=21 && abs(W-L)>=2 )||( L>=21 && abs(W-L)>=2)){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
}
i++;
}

return 0;
}
```

# 2 条评论

• @ 2017-04-07 19:05:49
``````#include <iostream>
#include <cstdio>
using namespace std;
int c;
int m,n,i;
int m1,n1;
int a[10000000];
int a1[10000000];
int b[10000000];
int b1[10000000];
int t,t1;
int main()
{
m=0;n=0;m1=0;n1=0;
t=1;
t1=1;
while((c=getchar())!=EOF)
{
if (c=='W')
{ ++m;++m1;}
if (c=='L')
{ ++n;++n1;}
if (c=='E')
{
a[t]=m;
a1[t]=n;
b[t1]=m1;
b1[t1]=n1;
break;
}
if (m==11&&m-n>=2)
{
a[t]=m;
m=0;
a1[t]=n;
n=0;
t++;
}
else if (m>11&&m-n>=2)
{
a[t]=m;
m=0;
a1[t]=n;
n=0;
t++;
}
else if (n==11&&n-m>=2)
{
a[t]=m;
m=0;
a1[t]=n;
n=0;
t++;
}
else if (n>11&&n-m>=2)
{
a[t]=m;
m=0;
a1[t]=n;
n=0;
t++;
}
if(m1==21&&m1-n1>=2)
{
b[t1]=m1;
b1[t1]=n1;
m1=0;
n1=0;
t1++;
}
else if(m1>21&&m1-n1>=2)
{
b[t1]=m1;
b1[t1]=n1;
m1=0;
n1=0;
t1++;
}
else if(n1>21&&n1-m1>=2)
{
b[t1]=m1;
b1[t1]=n1;
m1=0;
n1=0;
t1++;
}
else if(n1==21&&n1-m1>=2)
{
b[t1]=m1;
b1[t1]=n1;
m1=0;
n1=0;
t1++;
}
}
for(i=1;i<=t;i++)
cout<<a[i]<<":"<<a1[i]<<endl;
cout<<endl;
for(i=1;i<=t1;i++)
cout<<b[i]<<":"<<b1[i]<<endl;
return 0;
}
``````
• @ 2017-03-17 09:16:19

WHEN YOU INPUT 'E',

• @ 2017-10-04 14:30:44

谢谢您帮我解决了一个点，一直没想过直接输入E，我以为是给出的最后结果是11：10的话，要添加一个0：0 ,因为要继续比。

• 1

ID
1217

7

16276

3691

23%