lanqiao 19712 数字接龙
This commit is contained in:
@@ -10,6 +10,7 @@ int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};
|
|||||||
int dy[] = { 0, 1, 1, 1, 0, -1, -1, -1};
|
int dy[] = { 0, 1, 1, 1, 0, -1, -1, -1};
|
||||||
string res; // 结果字符串
|
string res; // 结果字符串
|
||||||
|
|
||||||
|
// x, y为搜索的位置坐标, pre 前一个访问位置的数字, s 当前路径的访问序列, dep 搜索的深度
|
||||||
void dfs(int x, int y, int pre, string s, int dep){
|
void dfs(int x, int y, int pre, string s, int dep){
|
||||||
if(x == n && y == n && dep == n*n){
|
if(x == n && y == n && dep == n*n){
|
||||||
if(res.empty()) res = s; // 字典需最小的
|
if(res.empty()) res = s; // 字典需最小的
|
||||||
|
|||||||
Reference in New Issue
Block a user