Skip to content

Commit bba33a1

Browse files
committed
Update 01.Digit-DP.md
1 parent 2de0f90 commit bba33a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Contents/10.Dynamic-Programming/09.Digit-DP/01.Digit-DP.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Solution:
118118
2. 如果遇到 $pos == len(s)$,表示到达数位末尾,此时:
119119
1. 如果 $isNum == True$,说明当前方案符合要求,则返回方案数 $1$。
120120
2. 如果 $isNum == False$,说明当前方案不符合要求,则返回方案数 $0$。
121-
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:`ans = 0`
121+
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:$ans = 0$
122122
4. 如果遇到 $isNum == False$,说明之前位数没有填写数字,当前位可以跳过,这种情况下方案数等于 $pos + 1$ 位置上没有受到 $pos$ 位的约束,并且之前没有填写数字时的方案数,即:`ans = dfs(i + 1, state, False, False)`
123123
5. 如果 $isNum == True$,则当前位必须填写一个数字。此时:
124124
1. 根据 $isNum$ 和 $isLimit$ 来决定填当前位数位所能选择的最小数字($minX$)和所能选择的最大数字($maxX$),
@@ -223,7 +223,7 @@ class Solution:
223223
2. 如果遇到 $pos == len(s)$,表示到达数位末尾,此时:
224224
1. 如果 $isNum == True$,说明当前方案符合要求,则返回方案数 $1$。
225225
2. 如果 $isNum == False$,说明当前方案不符合要求,则返回方案数 $0$。
226-
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:`ans = 0`
226+
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:$ans = 0$
227227
4. 如果遇到 $isNum == False$,说明之前位数没有填写数字,当前位可以跳过,这种情况下方案数等于 $pos + 1$ 位置上没有受到 $pos$ 位的约束,并且之前没有填写数字时的方案数,即:`ans = dfs(i + 1, state, False, False)`
228228
5. 如果 $isNum == True$,则当前位必须填写一个数字。此时:
229229
1. 根据 $isNum$ 和 $isLimit$ 来决定填当前位数位所能选择的最小数字($minX$)和所能选择的最大数字($maxX$),
@@ -320,7 +320,7 @@ class Solution:
320320
2. 初始数字 $1$ 出现的个数为 $0$。
321321
3. 开始时受到数字 $n$ 对应最高位数位的约束。
322322
2. 如果遇到 $pos == len(s)$,表示到达数位末尾,此时:返回数字 $1$ 出现的个数 $cnt$。
323-
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:`ans = 0`
323+
3. 如果 $pos \ne len(s)$,则定义方案数 $ans$,令其等于 $0$,即:$ans = 0$
324324
4. 如果遇到 $isNum == False$,说明之前位数没有填写数字,当前位可以跳过,这种情况下方案数等于 $pos + 1$ 位置上没有受到 $pos$ 位的约束,并且之前没有填写数字时的方案数,即:`ans = dfs(i + 1, state, False, False)`
325325
5. 如果 $isNum == True$,则当前位必须填写一个数字。此时:
326326
1. 因为不需要考虑前导 $0$ 所以当前位数位所能选择的最小数字($minX$)为 $0$。

0 commit comments

Comments
 (0)