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

哪位大哥帮帮忙?

Posted by liulaisheng at 2005-10-06 21:14:37 on Problem 1007
出现WA帮我看看.谢谢了.
代码如下:
#include<iostream.h>

void main (void)
{
	int i=0,j=0,k=0,n,m;
	int max=0,s=0,min=0;
	int b[50]={0};
	char ch[100];
	cin>>m>>n;
	cin.getline(ch,100);
	char a[100][150];
	for(i=0;i<n;i++)
	{
		cin.getline(a[i],150);
	}

	for(k=0;k<n;k++)
	{
		for(i=0;i<m;i++)
		{
			for(j=i;j<m;j++)
			{
				if(a[k][i]>a[k][j])b[k]++;
			}
		}
		if(b[k]>max)max=b[k];
	}
	min=max+1;
	for(j=0;j<n;j++)
	{
		for(i=0;i<n;i++)
		{
			if(b[i]<min)
			{
				s=i;
				min=b[i];
			}
		}
		cout<<a[s]<<endl;
		b[s]=max+1;
		min=max+1;
		s=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