| ||||||||||
| 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 | |||||||||
哪位帮我看看 discuss的数据都过了还是wa。。难道真的要考虑小写字母。。。。#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char str[100],telNUM[100001][9],map[]="22233344455566677778889999",ch;
int cmp(const void*elem1,const void *elem2)
{
return strcmp((char*)elem1,(char*)elem2);
}
void standardlizee(int n)
{
int i=0,j=0,len;
len =strlen(str);
for(i=0;i<len;i++)
{
if(str[i]>='A'&&str[i]<='Z')
{
telNUM[n][j]=map[str[i]-'A'];
j++;
}
if(j==3)
{
telNUM[n][j]='-';
j++;
}
if(str[i]>='0'&&str[i]<='9')
{
telNUM[n][j]=str[i];
j++;
}
}
}
int main()
{
int T,i=0,n,c=0,t;
scanf("%d",&T);
t=T;
ch=getchar();
while(t>0)
{
gets(str);
standardlizee(i);
i++;
t--;
}
qsort(telNUM[0],T,9,cmp);
for(i=0;i<T-1;i++)
{
n=1;
while(!strcmp(telNUM[i],telNUM[i+1])&&i<T-1)
{
n++;
i++;
}
if(n!=1)
{
c++;
printf("%s %d\n",telNUM[i],n);
}
}
if(c==0)
printf("No duplicates.\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator