| ||||||||||
| 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 | |||||||||
帮我看看,我的DFS,怎么做二进制,我还没经验In Reply To:要记录搜过的二进制状态。 Posted by:zhucheng at 2005-08-11 11:42:15 bool DFS(const int &depth, const double &l, const double &r)
{
if(depth==n)
return true;
int i;
for(i=1; i<=n; i++)
{
if(!data[i].visit)
{
if(l-data[i].left>=0 && r - data[i].right<=0)
{
data[i].visit = true;
if(DFS(depth+1,l-data[i].left,r - data[i].right))
{
printf("%d %d\n",data[i].loc,data[i].wei);
return true;
}
data[i].visit = false;
}
}
}
return false;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator