深搜 广搜
剑断青丝i
世界上唯一可以阻止你前进的就是懒惰
展开
-
第十届蓝桥杯C/C++ B组——迷宫(代码解释很详细)
本题总分:15 分【问题描述】 下图给出了一个迷宫的平面图,其中标记为 1 的为障碍,标记为 0 的为可 以通行的地方。010000 000100 001001 110000 迷宫的入口为左上角,出口为右下角,在迷宫中,只能从一个位置走到这 个它的上、下、左、右四个方向之一。对于上面的迷宫,从入口开始,可以按DRRURRDDDR 的顺序通过迷宫, 一共 10 步。其中 D、U、L、R 分别表示向下、向上、向左、向右走对于下面这个更复杂的迷宫(30 行 50 列),请找出一种通过迷宫的方式,原创 2020-10-13 13:58:44 · 6120 阅读 · 7 评论 -
程序设计:引爆炸弹(dfs)
在一个 n×m 的方格地图上,某些方格上放置着炸弹。手动引爆一个炸弹以后,炸弹会把炸弹所在的行和列上的所有炸弹引爆,被引爆的炸弹又能引爆其他炸弹,这样连锁下去。现在为了引爆地图上的所有炸弹,需要手动引爆其中一些炸弹,为了把危险程度降到最低,请算出最少手动引爆多少个炸弹可以把地图上的所有炸弹引爆。输入格式第一行输两个整数 n,m,用空格隔开。接下来 nn 行,每行输入一个长度为 mm 的字符...原创 2020-03-20 18:02:28 · 1589 阅读 · 17 评论 -
HDU1241-Oil Deposits(dfs染色)
Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a ...原创 2020-02-16 10:33:21 · 168 阅读 · 0 评论 -
POJ1979-Red and Black(dfs)
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. But he can’...原创 2020-02-15 20:06:53 · 234 阅读 · 23 评论 -
POJ-3050 Hopscotch(dfs)
The cows play the child’s game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes into which to hop, the cows create a 5x5 rectilinear grid of digits parallel to the x an...原创 2020-02-13 20:15:02 · 215 阅读 · 0 评论 -
POJ - 1321棋盘问题(DFS)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为...原创 2020-02-09 11:40:53 · 210 阅读 · 0 评论 -
迷宫问题(POJ-3984循环用BFS-C语言)
定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 × 5的二维数组,表示一个迷...原创 2020-02-01 13:12:04 · 414 阅读 · 0 评论 -
HDU1010-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 realized that the bone ...原创 2019-11-12 15:17:58 · 260 阅读 · 22 评论 -
Farm Irrigation(HDU - 1198)(dfs连通图)
Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has a different type of ...原创 2019-08-23 10:50:02 · 161 阅读 · 0 评论 -
胜利大逃亡(广搜)
Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个ABC的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Igna...原创 2019-08-20 14:58:23 · 143 阅读 · 1 评论