📄 2119046_ac_0ms_16k.c
字号:
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
struct node
{
char word[21];
}dic[101];
int cmp(const void *a,const void *b)
{
struct node *aa = (struct node *)a;
struct node *bb = (struct node *)b;
return strcmp(aa->word,bb->word);
}
void input()
{
int i, j, p;
int m;
int m1, m2, m3;
char tmp[100];
while(scanf("%s",&dic[0].word)==1&&strcmp(dic[0].word,"#")!=0)
{
i = 1;
while(scanf("%s",tmp)==1&&strcmp(tmp,"*")!=0)
{
strcpy(dic[i].word,tmp);
i++;
}
qsort(dic,i,sizeof(dic[0]),cmp);
j = 0;
while(scanf("%s",tmp)==1&&strcmp(tmp,"**")!=0)
{
for(m = 0; m < i; m++)
{
m1 = m2 = m3 = 0;
for(p = 0; !p||tmp[p-1]!='\0';p++)
if(tmp[p]!='|'&&tmp[p]!='\0')
{
if(m1||m2)
continue;
if(tmp[p]=='+')
{
if(!strchr(dic[m].word,tmp[p+1]))
m1 = 1;
p++;
}
else
if(tmp[p]=='-')
{
if(strchr(dic[m].word,tmp[p+1]))
m2 = 1;
p++;
}
else
if(!m3&&strchr(dic[m].word,tmp[p]))
m3 = 1;
}
else
if(m3&&!m1&&!m2)
{
puts(dic[m].word);
goto next;
}
else
m1 = m2 = m3 = 0;
}
printf("NONE\n");
next: ;
}
printf("$\n");
}
}
int main()
{
input();
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -