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

1002数据已经都测试了,怎么还是错

Posted by 11101018a at 2012-06-18 12:35:15
#include<stdio.h>
int main()
{
    static int i,j,k,n,hash[10000000]={0};
    char tel[32],map[256];
    map['A']=map['B']=map['C']=2;
    map['D']=map['E']=map['F']=3;
    map['G']=map['H']=map['I']=4;
    map['J']=map['K']=map['L']=5;
    map['M']=map['N']=map['O']=6;
    map['P']=map['R']=map['S']=7;
    map['T']=map['U']=map['V']=8;
    map['W']=map['X']=map['Y']=9;
    for(i='0';i<='9';i++)
    map[i]=i-'0';
    scanf("%d",&n);
    while(n--)
    {
      scanf("%s",tel);
      for(i=k=0,j=1000000;tel[i];i++)
      {
        if(tel[i]=='-')continue;
        k+=map[tel[i]]*j;
        j/=10;
      }
      hash[k]++;
     }
     for(i=j=0;i<10000000;i++)
     
     if(hash[i]>1)
     {
      j++;
      printf("%03d-%04d %d\n",i/10000,i%10000,hash[i]);
     }
     if(j==0)
     {
     puts("No duplicates.");
     
     }
}

        

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