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> #include <cmath> using namespace std; int main() { char codes[8][11]; int i,j,k,l,m,len; bool bt; i=0;m=0; while(scanf("%s",codes[i])!=EOF) { m++;i++; bt=false; while(1) { scanf("%s",codes[i]); if(codes[i][0]=='9') break; i++; } for(j=0;j<i;j++) { if(codes[j][0]=='0'){ len=strlen(codes[j]); for(k=1;k<len;k++) if(codes[j][k]!='0') break; for(l=k;l<=len;l++) codes[j][l-k]=codes[j][l]; } } for(j=0;j<i-1;j++) { for(k=j+1;k<i;k++) { if(strcmp(codes[j],codes[k])==0) {bt=true;break;} } if(bt==true) break; } printf("Set %d is ",m); if(bt==true) printf("not "); printf("immediately decodable\n"); i=0; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator