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 |
无限超时~~~~大牛路过帮帮谢谢~~~~#include<iostream> #include<cstring> #include<stdio.h> #include <stdlib.h> #include<algorithm> using namespace std; class telephone { public: telephone(int x=0){total=x;} char frount_num[4],end_num[5]; int total; }; void change(char *a,int *b) {static int j=0; int i=0,m=0; int n,i1; n=strlen(a); for(i1=0;i1<n;i1++) { if(a[i1]>='a'&&a[i1]<='z') a[i1]-=32; } b[j]=0; while(a[i]!='\0') { if(a[i]=='A'||a[i]=='B'||a[i]=='C'){b[j]=b[j]*10+2;} if(a[i]=='D'||a[i]=='E'||a[i]=='F'){b[j]=b[j]*10+3;} if(a[i]=='G'||a[i]=='H'||a[i]=='I'){b[j]=b[j]*10+4;} if(a[i]=='J'||a[i]=='K'||a[i]=='L'){b[j]=b[j]*10+5;} if(a[i]=='M'||a[i]=='N'||a[i]=='O'){b[j]=b[j]*10+6;} if(a[i]=='P'||a[i]=='R'||a[i]=='S'){b[j]=b[j]*10+7;} if(a[i]=='T'||a[i]=='U'||a[i]=='V'){b[j]=b[j]*10+8;} if(a[i]=='W'||a[i]=='X'||a[i]=='Y'){b[j]=b[j]*10+9;} if((a[i]>='0')&&(a[i]<='9')) { b[j]=b[j]*10+(a[i]-48); } i++; } j++; } void num_total(int *a,int *b,int n) { int i,j; for(i=0;i<n;) { for(j=0;j<n;j++) { if(a[i]==a[j]) b[i]++;} i=i+b[i]; } } int main() { int n,i,KKK=0,a1[100001],b1[100001]={0}; char s[50]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s",s); change(s,a1); } sort(a1,a1+n); num_total(a1,b1,n); for(i=0;i<n;i++) {if(b1[i]>1) { printf("%03d-%04d %d\n",a1[i]/10000,a1[i]%10000,b1[i]); KKK=1;} } if(KKK==0) printf("No duplicates."); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator