仙女的博客

面朝大海,然后春暖花开

排序:
默认
按更新时间
按访问量

HDU 1253 - 胜利大逃亡 ( dfs )

Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡...

2018-08-16 11:25:40

阅读数:42

评论数:0

关于搜索(DFS 、BFS)

深度优先搜索(DFS):     思想:             首先以一个未被访问过的顶点作为开始顶点,沿当前顶点的边走到未访问过的顶点;当没有未访问过的顶点时,则回溯到上一个顶点,继续试探访问别的顶点,直到所有的顶点都被访问过。 完整代码: #include<s...

2018-07-21 16:09:38

阅读数:23

评论数:0

HDU 2717 - Catch That Cow (BFS)

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a num...

2018-07-20 17:43:45

阅读数:29

评论数:0

HDU 1242 - Rescue (bfs)

Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs...

2018-07-20 16:23:33

阅读数:16

评论数:0

HDU 1548- A strange lift (DFS)

There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor...

2018-07-17 16:17:38

阅读数:24

评论数:0

HDU 1016- Prime Ring Problem (DFS)

A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjace...

2018-07-17 16:01:06

阅读数:15

评论数:0

HDU1312 - 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 ...

2018-07-16 19:41:34

阅读数:21

评论数:0

HDU1241 - Oil Deposits (DFS)

The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of...

2018-07-16 17:51:12

阅读数:55

评论数:0

HDU1010-Tempter of the Bone(DFS)

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 ...

2018-07-16 17:43:53

阅读数:34

评论数:0

广度优先搜索(宽度优先搜索)迷宫问题

使用队列,层层递进,往下扩展。      5 4      0 0 1 0      0 0 0 0      0 0 1 0      0 1 0 0      0 0 0 1      1 1 4 3 (5,4是迷宫的行和列,0代表空地,1代表障碍物,1,1是起始位置,4,3 是需要到达的...

2018-07-16 16:20:40

阅读数:151

评论数:0

深度优先搜索

#include<stdio.h> int a[10],book[10],n; void dfs(int step) { int i; if(step == n+1) { for(i = 1;i <= n;i ++) ...

2018-07-15 10:49:58

阅读数:49

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭