Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

借用您的思想

Posted by tzkq at 2010-07-24 21:22:04 on Problem 1520
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator