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

Re:这是1002题,哪位兄弟帮我看一下,不胜感激

Posted by yaker at 2006-05-02 15:32:45
In Reply To:这是1002题,哪位兄弟帮我看一下,不胜感激 Posted by:hudedi at 2005-12-06 22:45:14
> 我这题的问题是WA,帮忙看一下
> #include<stdio.h>
> #include<ctype.h>
> #include<string.h>
> #include<stdlib.h>
> #define num 100000
> 
> int cmp(const void *a,const void *b)
> {
>     return *(long long *)a-*(long long *)b;
> }
> int main()
> {
>     static long long phone[num];
>     long long times,time;
>     long long duplicates=1;
>     int ii,jj,kk;
>     int judge=0;
>     char a;
>     int dic[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
>     scanf("%I64d",×);
> 
>     time=times ;
>     phone[times]=-2;phone[times+1]=-2;phone[times+2]=-2;/*?防止出现0000000??????*/
> 
>     while(time--)
>     {
>         phone[time]=0;
>         for(ii=7;ii>0;)
>         {
>              scanf("%1s",&a);
>              if(isalnum(a))
>              {
>                  phone[time]=isalpha(a)?10*phone[time]+dic[a-'A']:10*phone[time]+a-'0';
>                  ii--;
>              }
>         }
>     }
>     qsort(phone,times,sizeof(phone[0]),cmp);
>     duplicates=1;
>     if(times<2)
>     {
>        printf("No duplicates.\n");
>                         return 0;
> 
>         }
>     for(jj=0;jj<times;jj++)
>     {
>          if(phone[jj]==phone[jj+1]) duplicates++;
>          else {
>                     if(duplicates!=1)
>                     {
> 
>                          printf("%d",phone[jj]/10000);
>                         printf("-");
>                         printf("%d ",phone[jj]%10000);
>                         printf("%I64d\n",duplicates);
> 
>                         judge=1;
> 
> 
>                         duplicates=1;
>                     }
>               }
>     }
>     if(!judge) printf("No duplicates.\n");
>    
>     
>     return 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