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 |
Re:还有什么没想到的吗?In Reply To:还有什么没想到的吗? Posted by:X_CrDjN at 2006-08-06 19:07:11 > # 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator