分类: bfs

13 篇文章

codevs1002搭桥 bfs+最小生成树
题目描述 Description 有一矩形区域的城市中建筑了若干建筑物,如果某两个单元格有一个点相联系,则它们属于同一座建筑物。现在想在这些建筑物之间搭建一些桥梁,其中桥梁只能沿着矩形的方格的边沿搭建,如下图城市1有5栋建筑物,可以搭建4座桥将建筑物联系起来。城市2有两座建筑物,但不能搭建桥梁将它们连接。城市3只有一座建筑物,城市4有3座建筑物,可…
NOIP模拟赛 大逃亡
题目描述: 给出数字N(1<=N<=10000),X(1<=x<=1000),Y(1<=Y<=1000),代表有N个敌人分布一个X行Y列的矩阵上,矩形的行号从0到X-1,列号从0到Y-1再给出四个数字x1,y1,x2,y2,代表你要从点(x1,y1)移到(x2,y2)。在移动的过程中你当然希望离敌人的距离的最小值…
poj 2312 Battle City
Battle City Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9170 Accepted: 3043 Description Many of us had played the game "Battle city" in our childhood, and some …
poj 2157 Maze
Maze Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3846 Accepted: 1220 Description Acm, a treasure-explorer, is exploring again. This time he is in a special maze…
noi题库 8468 单词序列
8468:单词序列 总时间限制:1000ms内存限制:1024kB 描述 给出两个单词(开始单词和结束单词)以及一个词典。找出从开始单词转换到结束单词,所需要的最短转换序列。转换的规则如下: 1、每次只能改变一个字母 2、转换过程中出现的单词(除开始单词和结束单词)必须存在于词典中 ...
poj 3278 Catch That Cow BFS
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 77719 Accepted: 24552 Description Farmer John has been informed of the location of a fugitive cow and…
poj 2251 Dungeon Master BFS
Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 27258 Accepted: 10689 Description You are trapped in a 3D dungeon and need to find the quickest way o…