lanqiao 19712 数字接龙
This commit is contained in:
@@ -30,7 +30,7 @@ void dfs(int x, int y, int pre, string s, int dep){
|
||||
vis[bx][by] = 1;
|
||||
dfs(bx, by, a[bx][by], s + to_string(i), dep + 1);
|
||||
|
||||
// 最优性剪枝
|
||||
// 最优性剪枝, 已经找到了一个可行序列, 不必再往后搜索
|
||||
if(!res.empty()) return;
|
||||
vis[bx][by] = 0; //回溯
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user