目前,可以确定(至少我觉得可以确定),不是由于WLE之外的字符或者末尾0:0导致的问题。
求助大佬,我人已经傻了
#include<stdio.h>
#include<string.h>
char games[62500];
char single_line[25];
void score(char games[],int win_score,int end)
{
int i;
int win=0,lost=0,leader,loser;
for(i=1;i<=end-1;i++)
{
if(games[i-1]=='W')
{
win++;
}
else if(games[i-1]=='L')
{
lost++;
}
leader=(win>lost)?win:lost;
loser=(win<lost)?win:lost;
if(leader==win_score&&leader-loser>=2)
{
printf("%d:%d\n",win,lost);
win=0;
lost=0;
}
}
printf("%d:%d\n",win,lost);
}
int main()
{
int r;
int end;
while(gets(single_line)!=NULL)
{
strcat(games,single_line);
}
for(r=1;r<=strlen(games);r++)
{
if(games[r-1]=='E')
{
end=r;
break;
}
}
score(games,11,end);
printf("\n");
score(games,21,end);
return 0;
}