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 feng2017 at 2007-06-16 15:53:17 on Problem 1617
很奇怪,我在排序的时候觉得两种方法的结果应该一样,但是却一个ac一个wa。谁帮我!
ac:
bool flag[10]={false};
		for(int i=0;i<len1;i++)
		{
			int lable=0;
			while(flag[lable])lable++;
			char dis=array1[lable];
			for(int j=lable+1;j<len1;j++)
			{
				if(!flag[j]&&(array1[j]<dis))
				{
					lable=j;
					dis=array1[lable];
				}
			}
			flag[lable]=true;
			num[i]=lable;
		}
wa:
	for(int i=0;i<len1;i++)
	{
		num[i]=i;
	}
	for(int j=0;j<len1-1;j++)
	{

		for(int k=j+1;k<len1;k++)
		{
			if(array1[j]>array1[k])
			{
				temp1=array1[j];
				array1[j]=array1[k];
				array1[k]=temp1;
				temp2=num[j];
				num[j]=num[k];
				num[k]=temp2;


			}
		}
	}

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