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

runtime error 请帮忙修改

Posted by ecjtubaowp at 2006-10-15 17:15:41 on Problem 2503
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int fun(const void *a,const void *b)
{
  return *(char *)a-*(char *)b;   
}
char a[100001][11],b[100001][11],c[11];
int main()
{
    int i,j,k,m,n,len;
    
    i=1;
    while(1)
    {
        scanf("%s%s",a[i],b[i]);
        if(a[i][0]=='\n')break;
        len=strlen(b[i]);
        qsort(b[i],len,sizeof(char),fun);
        
        i++;
    }
    k=i-1;
    while(scanf("%s",c)!=EOF)
    { len=strlen(c);
      qsort(c,len,sizeof(char),fun);
      printf("%s",c);
      for(i=1;i<=k;i++)
      {
          if(strcmp(c,b[i])==0){printf("%s\n",a[i]);break;}
          
      }
      if(i==k+1){printf("eh\n");}
      
        
    }
    
    
    
}

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