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

求指导!!给出的范例已经通过,在VC上没有问题,但是提交就是WA

Posted by 920102 at 2011-07-06 14:34:17 on Problem 1007
代码如下:
#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:
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