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 crackerwang at 2007-09-29 07:50:37 on Problem 3399
In Reply To:sigh...一天到晚就只想着数据…… Posted by:frkstyc at 2007-09-29 01:47:15
		sort(a,a+n);
		i=0;
		j=n-1;
		while(k)
		{
			if(k>=2)
			{
				t1=a[i]*a[i+1];
				t2=a[j]*a[j-1];
				if(t1>=t2)
				{
					flag[i]=flag[i+1]=1;
					i=i+2;
				}
				else
				{
					flag[j]=flag[j-1]=1;
					j-=2;
				}
				k-=2;
			}
			else
			{
				flag[j]=1;
				k=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