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

我的程序在自己电脑上过了,为什么会Wrong Answer.

Posted by 1155665 at 2007-05-26 10:03:14 on Problem 1007
#include<iostream.h>
void main()
{
	char a[100][51];
	int s[100]={0};
	char b[51];
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i];
	}
	for(int j=0;j<m;j++)
	{
		for(int k=0;k<n;k++)
		{
			for(int l=k+1;l<n;l++)
			{
				if(a[j][k]>a[j][l])
					s[j]++;
			}
		}
	}
	int x=0;
	for(int d=1;d<m;d++)
	{
		x=s[d];
		for(int v=0;v<n;v++)
		{
			b[v]=a[d][v];
		}
		for(int f=d-1;f>=0;f--)
		{
			if(x<s[f])
			{
				s[f+1]=s[f];
				for(int r=0;r<n;r++)
					a[f+1][r]=a[f][r];
			}
			else break;
		}
		s[f+1]=x;
		for(int w=0;w<n;w++)
			a[f+1][w]=b[w];
	}
	for(int y=0;y<m;y++)
		cout<<a[y]<<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