From 32b8b44724120988895dc6a7e750c8f0ca86ed61 Mon Sep 17 00:00:00 2001 From: krahets Date: Sat, 1 Jul 2023 05:07:02 +0800 Subject: [PATCH] build --- .../intro_to_dynamic_programming.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter_dynamic_programming/intro_to_dynamic_programming.md b/chapter_dynamic_programming/intro_to_dynamic_programming.md index 936230e83..884e76157 100644 --- a/chapter_dynamic_programming/intro_to_dynamic_programming.md +++ b/chapter_dynamic_programming/intro_to_dynamic_programming.md @@ -968,10 +968,6 @@ $$ - 当 $j$ 等于 $1$ ,即上一轮跳了 $1$ 阶时,这一轮只能选择跳 $2$ 阶; - 当 $j$ 等于 $2$ ,即上一轮跳了 $2$ 阶时,这一轮可选择跳 $1$ 阶或跳 $2$ 阶; -![考虑约束下的递推关系](intro_to_dynamic_programming.assets/climbing_stairs_constraint_state_transfer.png) - -

Fig. 考虑约束下的递推关系

- 在该定义下,$dp[i, j]$ 表示状态 $[i, j]$ 对应的方案数。由此,我们便能推导出以下的状态转移方程: $$ @@ -981,6 +977,10 @@ dp[i, 2] = dp[i-2, 1] + dp[i-2, 2] \end{cases} $$ +![考虑约束下的递推关系](intro_to_dynamic_programming.assets/climbing_stairs_constraint_state_transfer.png) + +

Fig. 考虑约束下的递推关系

+ 最终,返回 $dp[n, 1] + dp[n, 2]$ 即可,两者之和代表爬到第 $n$ 阶的方案总数。 === "Java"