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 X_CrDjN at 2006-08-06 19:07:01 on Problem 1007
# include <stdio.h>
# include <string.h>
main()
{char x[101][51],y[101][51],temp[51];int n,m,p,xx=0,g;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++)
{p=getchar();//清掉回车符
for(j=0;j<n;j++){
p=getchar();
x[i+1][j+1]=p;
}
for(j=0;j<n;j++){for(g=j+2;g<=n;g++){if(x[i+1][j+1]>x[i+1][g]) xx+=1;}}
x[i+1][0]=xx;xx=0;
}
for(i=0;i<m;i++){for(j=i+1;j<m;j++){if(x[i+1][0]>x[j+1][0]) {strcpy(temp,x[i+1]);strcpy(x[i+1],x[j+1]);strcpy(x[j+1],temp);}}
}
for (i=1;i<=m;i++){for (j=1;j<=n;j++){printf("%c",x[i][j]);}
		printf("\n");
		}
}

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