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 |
借用您的思想In Reply To:Re:这题目真是麻烦 Posted by:fishing_test at 2009-04-18 20:55:24 char s[5555],* c,a[99][99],b[99][99],T[99],Y[99],B[99]; int k,l,i,j,f; int C1(char*a,char*b){ return strcmp(strlwr(strcpy(Y,a)),strlwr(strcpy(T,b))); } int C2(char*a,char*b){ return atoi(a)-atoi(b); } int main(){ for(;gets(s)&&s[0]!='.';puts(".")){ for(i=k=l=0,c=strtok(s,",. ");c;c=strtok(0,",. ")) strcpy((B[i++]=isalpha(*c))?a[k++]:b[l++],c); qsort(a,k,sizeof(a[0]),C1); qsort(b,l,sizeof(b[0]),C2); for(f=i=j=0;i<k||j<l;f++) printf("%s%s",f?", ":"",B[f]?a[i++]:b[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