为什么最后一个数据wa了
查看原帖
为什么最后一个数据wa了
1077077
WANG2628294287楼主2024/11/26 18:27
#include <stdio.h>
char s[1000050];
int a[1000050][26],count[1000050];
int cut=0;
int zt[1000050]={0};
int zzt[1000050]={0};
void insert(char *b)
{
    int i,p,j;
    for(i=0,p=0;b[i];i++)
    {
        j=b[i]-'a';
        if(!a[p][j]) a[p][j]=++cut;
        p=a[p][j];
    }
    
    count[p]++;
   
}
int find(char *b)
    {
        int i,p,j;
        for(i=0,p=0;b[i];i++)
        {
            j=b[i]-'a';
            if(!a[p][j]) return 0;
            p=a[p][j];
        }
    if(zt[p]==0){zt[p]++;return -1;}
    else return 1;
    }

int main()
{

    int number,i=0;
    scanf("%d",&number);
    for(i=0;i<number;i++)
    {
        scanf("%s",s);
        insert(s);
        
    }
    scanf("%d",&number);
    for(i=0;i<number;i++)
    {
        scanf("%s",s);
        if(find(s)==-1) zzt[i]=1;
        else if(find(s)==1)  zzt[i]=2;
        else zzt[i]=0;
    }
    for(i=0;i<number;i++)
    {
        if(zzt[i]==1)
            printf("OK\n");
        else if(zzt[i]==2)printf("REPEAT\n");
        else
            printf("WRONG\n");
    }
    return 0;
 
   
}

Wrong Answer.wrong answer On line 1 column 1, read O, expected W.

2024/11/26 18:27
加载中...