![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
文章平均质量分 57
z-chuner
这个作者很懒,什么都没留下…
展开
-
记忆化搜索
地宫取宝 AC代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 55; const long long mod = 1000000007; int n, m, k, mp[N][N], ans; int dx[2] = {0, 1}; int dy[2] = {1, 0}; ll dp[N][N][15][15]; ///dp[x][y][num][maxvalue]: ///走原创 2021-01-12 12:04:58 · 74 阅读 · 0 评论 -
2n皇后
2n皇后问题 解题思路 1.先放置白皇后,再考虑第二个皇后 2.那么白皇后要怎么放呢,皇后不能同行同列,不能在同一条左斜线和右斜线。我们的递归函数是从第一行递归到最后一行,所以我们不需要标记行,那么我们拿三个数组分别标记列和两个斜线的占用情况。列的标记很容易理解,那么怎么标记左斜线和右斜线的占用情况呢?我们以左斜线为例子,请看图 我们很容易可以发现黄线路径的每个格子行和列之和是相等的,比如(1,4)(2,3)的和都是5。同理观察一下红线,可以发现红线路径的格子行和列之和都为9。可以知道,左斜线的规律就是同原创 2021-03-02 22:14:49 · 82 阅读 · 0 评论 -
Sudoku
Description Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other cells are empty. The goal is to fill the e原创 2021-01-05 23:24:56 · 138 阅读 · 0 评论