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> int main() { int n,i,j=2,num[10000],flag,k,count=0,order[10000]; char turn[26],str[80],ch[10000][9],mid[9]; strcpy(ch[0],"999-9999"); order[0]=0; num[0]=0; for(i=0;i<26;i++) { turn[i]=j+'0'; if(i<16&&(i+1)%3==0) j++; else if(i>16&&i%3==0) j++; } scanf("%d",&n); for(i=0;i<n;i++) { k=0; scanf("%s",str); for(j=0;str[j]!='\0';j++) { if(k==3) mid[k++]='-'; if(str[j]>='0'&&str[j]<='9') mid[k++]=str[j]; else if(str[j]>='A'&&str[j]<'Z') mid[k++]=turn[str[j]-'A']; } mid[k]='\0'; for(j=count;j>=0;j--) { flag=strcmp(mid,ch[order[j]]); if(flag==0) { num[order[j]]++; break; } else if(flag>0) { for(k=count;k>j;k--) order[k+1]=order[k]; count++; strcpy(ch[count],mid); order[j+1]=count; num[count]=1; break; } } if(j<0) { for(k=count;k>=0;k--) order[k+1]=order[k]; count++; order[j+1]=count; strcpy(ch[count],mid); num[count]=1; } } for(i=0;i<=count;i++) { j=order[i]; if(num[j]>1) printf("%s %d\n",ch[j],num[j]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator