-
2005-07-06
ZJU1808
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://betaver.blogbus.com/logs/1299968.html
#include <stdio.h>
#include <stdlib.h>char c[50][50];
int in(int x,int y)
{
for (int i=0;i<50;i++)
{
if (c[x][i]=='\0' || c[y][i]=='\0') return 0;
if (c[x][i]!=c[y][i]) return 1;
}
return 0;
}int main()
{
int n,r,t,s;
for (s=1;;s++)
{
n=0;r=1;
while (1)
{
if (scanf("%s",&c[n])==EOF) exit(0);
if (c[n][0]=='9') break;
n++;
}
//insert code here
for (int i=0;i<n-1;i++)
for (int j=i+1;j<n;j++){
t=in(i,j);
if (r==1) r=t;
}
printf((r==1)?"Set %d is immediately decodable\n":"Set %d is not immediately decodable\n",s);
}
}
收藏到:Del.icio.us







