lanqiao 19712 数字接龙
This commit is contained in:
@@ -29,6 +29,7 @@ void dfs(int x, int y, int pre, string s, int dep){
|
||||
if((a[bx][by] < k && a[bx][by] == pre + 1) || (pre + 1 == k && a[bx][by] == 0)){
|
||||
vis[bx][by] = 1;
|
||||
dfs(bx, by, a[bx][by], s + to_string(i), dep + 1);
|
||||
|
||||
// 最优性剪枝
|
||||
if(!res.empty()) return;
|
||||
vis[bx][by] = 0; //回溯
|
||||
@@ -51,7 +52,7 @@ int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* test samples
|
||||
/* test samples -> 41255214
|
||||
3 3
|
||||
0 2 0
|
||||
1 1 1
|
||||
|
||||
Reference in New Issue
Block a user