This commit is contained in:
krahets
2023-10-18 02:16:55 +08:00
parent 64c5d13051
commit d2ba55fcd6
22 changed files with 374 additions and 436 deletions

View File

@ -343,7 +343,7 @@ comments: true
int choices[2] = {1, 2}; // 可选择向上爬 1 或 2 阶
int state = 0; // 从第 0 阶开始爬
int *res = (int *)malloc(sizeof(int));
*res = 0; // 使用 res[0] 记录方案数量
*res = 0; // 使用 res[0] 记录方案数量
int len = sizeof(choices) / sizeof(int);
backtrack(choices, state, n, res, len);
int result = *res;