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 |
求指导!!给出的范例已经通过,在VC上没有问题,但是提交就是WA代码如下: #include"stdio.h" main() { char a[101][51]; int m,n,s,l,p,i,j,h,f; int b[51][51]; scanf("%d %d",&n,&m); for(i=0;i<m;i++) gets(a[i]); for(i=0;i<m;i++) { b[i][1]=0;b[i][0]=i; for(j=0;j<n-1;j++) for(p=j+1;p<n;p++) if(a[i][j]>a[i][p]) b[i][1]++; } for(i=m-1;i>=1;i--) for(j=1;j<=i;j++) if(b[j+1][1]>b[j][1]) { h=b[j][0];b[j][0]=b[j+1][0];b[j+1][0]=h; s=b[j][1];b[j][1]=b[j+1][1];b[j+1][1]=s; } for(i=0;i<m;i++) { f=b[i][0]; puts(a[f]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator