| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:要剪支的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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator