![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS+BFS
charote233
这个作者很懒,什么都没留下…
展开
-
Red and Black(基础DFS)
Description 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 tiles.原创 2016-07-28 20:47:30 · 257 阅读 · 0 评论 -
Avoid The Lakes(DFS)
Description Farmer John’s farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, howe原创 2016-07-28 20:59:09 · 175 阅读 · 0 评论 -
变形课(DFS)
Description 呃……变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经将他所会的所有咒语都列成了一个表,他想让你帮忙计算一下他是否能完成老师的作业,将一个B(ball)变成一个M(Mous原创 2016-07-28 21:03:59 · 802 阅读 · 0 评论 -
Tempter of the Bone(DFS+剪枝)
Description 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 realized th原创 2016-07-28 21:15:40 · 186 阅读 · 0 评论 -
N皇后问题(经典DFS)
Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output 共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sam原创 2016-07-28 21:22:44 · 478 阅读 · 0 评论 -
棋盘问题(经典DFS)
Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 ,原创 2016-07-28 21:24:35 · 1155 阅读 · 0 评论