hdu 2736 Surprising Strings(类似哈希,字符串处理)

时间:2020-12-22 03:02:34

重点在判重的方法,嘻嘻

题目

#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,len,mark[],num,flag;
char ch[];
while(gets(ch))
{
if(strcmp("*",ch)==)break;
len=strlen(ch);
flag=;
for(i=;i<len;i++)
{
memset(mark,,sizeof(mark));
for(j=;j<len-i;j++)
{
num=(ch[j]-'A'+)*+ch[j+i]-'A'+;
if(mark[num]==)
{
flag=;
break;
}
mark[num]=;
}
if(flag==)break;
}
if(flag==)
printf("%s is NOT surprising.\n",ch);
else
printf("%s is surprising.\n",ch);
}
return ;
}