Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1523701
  • 博文数量: 399
  • 博客积分: 8508
  • 博客等级: 中将
  • 技术积分: 5302
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-14 09:28
个人简介

能力强的人善于解决问题,有智慧的人善于绕过问题。 区别很微妙,小心谨慎做后者。

文章分类

全部博文(399)

文章存档

2018年(3)

2017年(1)

2016年(1)

2015年(69)

2013年(14)

2012年(17)

2011年(12)

2010年(189)

2009年(93)

分类: LINUX

2010-06-03 23:01:21

#include
#include
#include
using namespace std;
int code[]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};
int  base[]={1,10,100,1000,10000,100000,1000000};

int  array[100005];
int total;
int main()
{
    int n,len,m;
    int num,t,i;
    char s[100];
    scanf("%d",&n);
    m=0;
    for(i=0;i    {
        scanf("%s",s);                    
        t=0;num=0;
        len=strlen(s);        
        for(int j=len-1;j>-1;j--)
        {
            if(s[j]=='-') continue;
            if(s[j]>='0'&&s[j]<='9')
                num+=(s[j]-'0')*base[t++];        
            else
                num+=(code[s[j]-'A'])*base[t++];
        }
        array[m++]=num;
    }
    sort(array,array+m);
    int b=0;
    for(i=0;i    {
        if(i==0)
        {
            total=1;continue;
        }
        if(array[i]!=array[i-1])
        {
            if(total>1){    
            printf("%03d-%04d %d\n",array[i-1]/10000,array[i-1]%10000,total);
            if(!b)         b=1;
            }
            total=1;
            continue;
        }
        total++;
    }
    if(total>1){    
        printf("%03d-%04d %d\n",array[i-1]/10000,array[i-1]%10000,total);
        if(!b)         b=1;
    }

    if(!b)         printf("No duplicates.\n");
    return 0;
}
阅读(605) | 评论(0) | 转发(0) |
0

上一篇:1001

下一篇:1276

给主人留下些什么吧!~~