Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我都不敢交了,不知道哪里错了,就是通不过。有没有高手指点下啊!!#include <iostream.h> #include <string.h> #include <stdio.h> int Input(char *string){ cin.getline(string,10); if(*string=='9')return 0; return 1; } int min(int x,int y){ return x<y?x:y; } char string[10][11]; void main(){ int i=0,j,test=1; int lenth1,lenth2,k,n; int mi; int flag1,flag2; while(1){ for(;i<10;i++)strcpy(string[i],""); i=0; while(Input(string[i])){i++;} for(j=0;j<i;j++){ flag2=0; for(k=0;k<i;k++){ if(j!=k){ lenth1=strlen(string[j]); lenth2=strlen(string[k]); mi=min(lenth1,lenth2); flag1=0; for(n=0;n<mi;n++){ if(string[j][n]==string[k][n])continue; else { flag1=1; break; } } if(flag1==0){flag2=1;break;} } } if (flag2==1)break; } if(flag2==1)printf("Set %d is not immediately decodable\n",test); else printf("Set %d is immediately decodable\n",test); test++; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator