Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

实在看不出哪里错了

Posted by cyfno1 at 2010-09-02 22:50:34 on Problem 1056
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator