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 |
剪枝方法对当前翻动棋子的前一行进行检测 假如当前翻动棋子的坐标为(x,y),假设save[4][4]保棋子的信息 void DFS(...) { for(...) //进行DFS { if(x>=1&&y>=1) //检测前一行,进行剪枝 { if(x-1>=0) save[x-1][y]=~save[x-1][y]; for(j=0;j<y;j++) if(save[x-1][j]!=save[x-1][j+1]) break; if(x-1>=0) save[x-1][y]=~save[x-1][y]; if(j!=y) continue; } ... //修改数据 DFS(...); ... //回滚数据 } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator