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

Re:要剪支的

Posted by caogtaa at 2007-02-23 21:10:30 on Problem 2362
In Reply To:要剪支的 Posted by:yesiam at 2005-04-07 13:18:27
	for(i=0;i<4;i++){
		int temp=sticks[cur]+x[i];
		if(temp>a)return 1;
		x[i]=temp;
		if(x[i]==a)cen++;
		if(DFS(cur+1,cen)==0)return 0;
		if(x[i]==a)cen--;
		x[i]-=sticks[cur];
	}
这里 if(temp>a) 为什么就剪枝了?要是正好x[i]==a 了呢?
	if(cen==3){
		if(x[3]+sums[cur]==a)return 1;
		return 0;
	}
if( x[3]+sums[cur]==a ) 不就是一个可行解不是应该 return 0;吗?
还有在 ZOJ上程序是WA啊~

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