| ||||||||||
| 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 | |||||||||
本人很菜,哪位帅哥牛人帮忙看下,谢谢#include"stdio.h"
#include"string.h"
void main()
{int x,y,d[30],i,k,j,s,t,m,n,l,o,b[30][50],q,w;
char a[30][50],temp[50];
for(i=0;i<=29;i++)
d[i]=0;
scanf("%d %d",&y,&x);
for(m=0;m<=x-1;m++)
scanf("%s",a[m]);
for(k=0;k<=x-1;k++)
{for(j=0;j<=y-1;j++)
for(s=j+1;s<=y-1;s++)
if(a[k][j]>a[k][s])d[k]++;
}
for(l=x-1;l>=1;l--)
for(o=x-1;o>=x-l;o--)
{if(d[o-1]<d[o])
{strcpy(temp,a[o-1]);
strcpy(a[o-1],a[o]);
strcpy(a[o],temp);
}
}
for(t=x-1;t>=0;t--)
printf("%s\n",a[t]);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator