标题效果:一些养殖场是由一些南北或东西向的道路互连。镶上在不断的过程中会问两个农场是什么曼哈顿的距离,假设现在是不是通信。那么输出-1。思维:并与正确集中检查,f[i]点i至father[i]距离,为了维持两个值,一个是东西向的距离。一个是南北向的距离,由于以后更新的时候要用到。在合并的时候有些特殊...
分类:
Web程序 时间:
2015-08-08 13:29:01
阅读次数:
188
题目的意思是:给你一个迷宫,0代表墙,1代表路,2代表起始位置,3代表终点,4代表爆破装置。一开始,你在2的位置,求到3的最少步数。
起初,你只有6秒钟的时间,时间减到0,你没到3的位置,代表不能出去,输出-1.想要增加时间,可以引爆爆破装置,引爆之后,时间重置为6,可以引爆多个。到引爆装置的时候,时间必须大于0,不然没有时间可以引爆。
迷宫最大是8 * 8。用广度优先搜索可以简单的解决问题。...
分类:
Web程序 时间:
2015-07-19 12:03:33
阅读次数:
128
Nightmare时间限制:1000ms | 内存限制:65535KB难度:4描述Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth h...
分类:
Web程序 时间:
2015-07-09 00:18:10
阅读次数:
142
http://acm.hdu.edu.cn/showproblem.php?pid=1240开始没仔细看题,看懂了发现就是一个裸的bfs,注意坐标是三维的,然后每次可以扩展出6个方向。第一维代表在第几层。后两维代表行和列。 1 #include 2 #include 3 #include 4 ...
分类:
Web程序 时间:
2015-05-28 15:39:07
阅读次数:
124
双向BFS。注意,任何一个点出队后,首先需要考虑ghost。 1 /* 3085 */ 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 ...
分类:
Web程序 时间:
2015-02-27 17:00:10
阅读次数:
192
Problem Description
Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb...
分类:
Web程序 时间:
2015-02-22 14:40:33
阅读次数:
227
Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of the bomb is set to 6 minutes. To preve...
分类:
Web程序 时间:
2015-02-12 22:51:36
阅读次数:
188
Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uDescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with...
分类:
其他好文 时间:
2015-01-27 21:32:30
阅读次数:
171
题目大意:John是一个农场主,他的牛很懒,拒绝按照John选的路走。John不得不找一条
最短的路。这道题的输入前半部分和POJ1984"Navigation Nightmare"相同。在每组数据
之后是一个整数K,接下来K行是询问(u,v)的曼哈顿距离(u,v是农场编号)。最后输出所有
询问结果。
POJ1984链接:http://poj.org/problem?id=1984
思路:本题输入有些特殊,给出的是某点在某点的某个方向(东西南北)有多远。由于输入数
据比较特殊。全部是有向边,且构不成回路,所...
分类:
编程语言 时间:
2014-12-31 21:31:53
阅读次数:
174