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

Re:可是我找不出这方面的问题啊,附上原代码,帮我看一下

Posted by yangjie at 2005-06-04 10:46:54 on Problem 1007
In Reply To:多看看FAQ Posted by:TN at 2005-06-04 10:43:30
#include <iostream.h>
void  main()
{
	char num[200][200];
	int number[200];
	int M,N,maxIndex,j,m,n,i;
	cin>>N>>M;
	for(i=0;i<M;i++)
		for(j=0;j<N;j++)
			cin>>num[i][j];
    for(i=0;i<M;i++)
	{
		number[i]=0;
		for( m=0;m<N;m++)
		  for(j=m;j<N;j++)
			  if(num[i][m]>num[i][j])number[i]++;
	}
	for(i=0;i<M;i++)
	{
      maxIndex=i;
	  for(j=0;j<M;j++)
		  if(number[j]<number[maxIndex])
			  maxIndex=j;
      for(n=0;n<N;n++)
			  cout<<num[maxIndex][n];
			  cout<<endl;
			  number[maxIndex]=1000;
	}

}
			  

		  

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