![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS(深度优先搜索)
阿里斯顿k
这个作者很懒,什么都没留下…
展开
-
DFS(深度优先搜索)
Red and Black There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent t...原创 2018-08-01 10:42:30 · 261 阅读 · 0 评论 -
DFS(剪枝加回朔)
Tempter of the Bone The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He ...原创 2018-08-01 20:35:51 · 437 阅读 · 0 评论 -
放苹果(DFS)
放苹果 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 这里写代码片 Input 第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。 Output 对输入的每组数据M和N,用一行输出相应的K。...原创 2018-08-01 20:39:41 · 465 阅读 · 0 评论 -
棋盘问题(DFS 回朔)
棋盘问题 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 ...原创 2018-08-01 20:58:13 · 445 阅读 · 0 评论