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

哪位大哥帮忙看看啊!题目给的测试数据过了,可是Runtime Error了!!!

Posted by cqxhh at 2004-10-23 00:00:00 on Problem 1007
#include <iostream.h>
#include <string.h>
void main()
{
	int i,n,j,s,k,h,temp,b[102];
	char a[52][102];
	char str;
	cin>>n>>s;
	for (i=1;i<=s;i++)
	{
		for (j=1;j<=n;j++)
			cin>>a[i][j];
	}
	for (i=1;i<=s;i++)
	{
		h=0;
		for (j=1;j<=n;j++)
		{
			for (k=n;k>j;k--)
			{
				if (a[i][j]>a[i][k])
					h++;
			}
		}
		b[i]=h;
	}
	for (i=1;i<=s;i++)
	{
		for (j=s;j>i;j--)
		{
			if (b[j-1]>b[j])
			{
				temp=b[j];
				b[j]=b[j-1];
				b[j-1]=temp;
				for (k=1;k<=n;k++)
				{
					str=a[j][k];
					a[j][k]=a[j-1][k];
					a[j-1][k]=str;
				}
			}
		}
	}
	for (i=1;i<=s;i++)
	{
		for (j=1;j<=n;j++)
			cout<<a[i][j];
		cout<<endl;
	}
}









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