Loading docs/dp/state.md +9 −7 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ ## 例题 ??? note "[「SCOI2005」互不侵犯](https://loj.ac/problem/2153)" 在 $ N \times N $ 的棋盘里面放 $ K $ 个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共 $ 8 $ 个格子。 我们用 $ f(i,j,l) $ 表示前 $ i $ 行,当前状态为 $ j $ ,且已经放置 $ l $ 个国王时的方案数。 Loading @@ -22,6 +23,7 @@ 需要注意在转移时排除相邻两行国王互相攻击的不合法情况。 ??? "参考代码" ```cpp #include <iostream> #include <algorithm> Loading Loading
docs/dp/state.md +9 −7 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ ## 例题 ??? note "[「SCOI2005」互不侵犯](https://loj.ac/problem/2153)" 在 $ N \times N $ 的棋盘里面放 $ K $ 个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共 $ 8 $ 个格子。 我们用 $ f(i,j,l) $ 表示前 $ i $ 行,当前状态为 $ j $ ,且已经放置 $ l $ 个国王时的方案数。 Loading @@ -22,6 +23,7 @@ 需要注意在转移时排除相邻两行国王互相攻击的不合法情况。 ??? "参考代码" ```cpp #include <iostream> #include <algorithm> Loading