只对两个 样例都过了 为啥呀 求调
查看原帖
只对两个 样例都过了 为啥呀 求调
910387
Whatever323楼主2025/8/31 11:28
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
char c[25*2501];
int main()
{
    char a;
    int p=0;
    for(;;)
    {
        a=getchar();
        if(a=='E')
        {
            break;
        }
        if(a!='\n')
            c[p++]=a;
    }
    int l=strlen(c);

    int win=0,lose=0;
    for(int i=0;i<l;i++)
    {
        if(c[i]=='W')
        {
            win++;
        }
        else
        {

            lose++;
        }
        if((win>=11||lose>=11)&&abs(win-lose)>=2)
        {
            printf("%d:%d\n",win,lose);
            win=0;
            lose=0;
        }
    }
    printf("%d:%d\n\n",win,lose);
    win=0;lose=0;


    for(int i=0;i<l;i++)
    {
        if(c[i]=='W')
        {
            win++;
        }
        else
        {

            lose++;
        }
        if((win>=21||lose>=21)&&abs(win-lose)>=2)
        {
            printf("%d:%d\n",win,lose);
            win=0;
            lose=0;
        }
    }
    printf("%d:%d",win,lose);
    return 0;

}

2025/8/31 11:28
加载中...