This commit is contained in:
krahets
2024-04-13 21:17:44 +08:00
parent 9332a91e26
commit 6afa70e7bc
55 changed files with 334 additions and 182 deletions

View File

@ -184,7 +184,9 @@ comments: true
if state + choice > n {
continue
}
// 尝试:做出选择,更新状态
backtrack(choices: choices, state: state + choice, n: n, res: &res)
// 回退
}
}
@ -1597,7 +1599,9 @@ $$
var a = 1
var b = 2
for (i in 3..n) {
b += a.also { a = b }
val temp = b
b += a
a = temp
}
return b
}