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 |
计数可能很大 因此 wa 了无限久#include<stdio.h> #include<string.h> #define max 10000001 int o[max]; int main() { char s[100]; int i,j,c; int a,n,sum,l; scanf("%ld",&n); gets(s); for(a=0;a<max;a++) o[a]=0; for(a=0;a<n;a++) { memset(s,0,sizeof(s)); gets(s); sum=0; i=0; j=-1; l=strlen(s); while(j<l) { j++; if(((s[j]>='A')&&(s[j]<'Z'))||((s[j]>='0')&&(s[j]<='9'))) { if((s[j]>='A')&&(s[j]<'Z')) { if(s[j]<'S') c=(s[j]-'A')/3+2; else c=(s[j]-'A'-1)/3+2; } else c=s[j]-'0'; i++; sum=sum*10+c; } } if(i==7) o[sum]++; } c=0; for(a=0;a<max;a++) if(o[a]>1) { c=1; i=a/10000;j=a%10000; printf("%03d-%04d %d\n",i,j,o[a]); } 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