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

新手求助~!~!!!!!SAMPLE OUTPUT是对的,不知道为什么会OLE呢???哪位前辈给指点一下~谢谢!

Posted by simplefish at 2006-11-05 16:14:29 on Problem 1007
#include<stdio.h>
int main()
{
	int m,k,i,j,n,temp_1,num[100];
	char a[100][50],*p[100],*ptemp;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)
		scanf("%s",a[i]);
	for(i=0;i<m;i++)
	{
		num[i]=0;
		for(j=0;j<n-1;j++)
			for(k=j+1;k<n;k++)
			{
				if(a[i][j]-a[i][k]>0)
					num[i]+=1;
			}
	}
	for(i=0;i<m;i++)
		p[i]=a[i];
	for(i=0;i<m-1;i++)
	{
		for(j=0;j<m-i-1;j++)
		{
			if(num[j]<=num[j+1])
			{
				temp_1=num[j];
				num[j]=num[j+1];
				num[j+1]=temp_1;
				ptemp=p[j];
				p[j]=p[j+1];
				p[j+1]=ptemp;
			}
		}
		printf("%s\n",p[j]);
	}
	printf("%s\n",p[0]);
	return 0;
}

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