0分求助

P1042 [NOIP2003 普及组] 乒乓球

odyy345 @ 2024-05-10 20:58:03

输入输出与题目样例一致,但不知道为什么过不去

#include <stdio.h>
#include <stdlib.h>
int main()
{
    char input[65536] = {0};
    scanf("%[^E]",&input);
    for (int i, win, lose, end = 0; end == 0; i++ )
    {

        if (input[i] == 'W')
        {
            win++;
        }
        if (input[i] == 'L')
        {
            lose++;
        }
        if (input[i] == '\0')
        {
            end = 1;
        }
        if ((((win >= 11) || (lose >= 11)) && (abs(lose-win) >= 2)) || ( (input[i] == '\0')))
        {
            printf("%d:%d\n",win,lose);
            win = 0;
            lose = 0;
        }
    }
    printf("\n");
    for (int i, win, lose, end = 0; end == 0; i++ )
    {
        if (input[i] == 'W')
        {
            win++;
        }
        if (input[i] == 'L')
        {
            lose++;
        }
        if (input[i] == '\0')
        {
            end = 1;
        }
        if ((((win >= 21) || (lose >= 21)) && (abs(lose-win) >= 2)) || ( (input[i] == '\0')))
        {
            printf("%d:%d\n",win,lose);
            win = 0;
            lose = 0;
        }
    }
    return 0;
}

by aleavf @ 2024-05-21 20:00:39

@odyy345

我用编译器编译后就结束运行了


|