原题: ZOJ 3674http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3674题意不难理解,很容易想到用暴力,但是无从下手,不知道怎么实现。后来看了网上的代码,直接用vector和map暴力,用到了set_intersect...
分类:
其他好文 时间:
2014-07-08 22:04:57
阅读次数:
239
Description
Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east or west one cell at a step. T...
分类:
其他好文 时间:
2014-07-08 21:04:29
阅读次数:
347
题意:首先给你空闲的位置,可以跳过几个来吃掉几个,求最短的吃完所有的,且最后一个回到开始指定的位置
思路:BFS+HASH判重,对于每个位置有六个方向,当然有的是不能走的,加上map的判重就可以了
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAXN =...
分类:
其他好文 时间:
2014-07-08 19:29:38
阅读次数:
246
最小生成树+BFS
题意是说在迷宫之中找出连接所有点的最小生成树,其他杂项完全不理会,我理解题意就花了好久。
我用的Kruskal,输入的时候给每个点标号,然后BFS 每个点,找出最近的所有边,接下来就是模版的Kruskal。
因为是迷宫,所以只能用BFS去搜与它相通的每个点的最短路。
不过数据有点坑,建议数组开大一点,我提交的时候RE一次,绝对不止100个...
分类:
其他好文 时间:
2014-07-08 18:34:52
阅读次数:
240
题目:hdu:4771Stealing Harry Potter's Precious
题目大意:给出n* m的矩阵,代表n * m间room,然后每个房间又有脆弱和坚固之分,分别用‘.'和'#‘代替。’@‘代表Dudely所在的起点。
题目说Dudely想要偷Harry的宝物,他知道宝物的位置,但是他的魔法只能穿过脆弱的room。愚蠢的他又想偷完harry所有的宝物,并不在乎如何人出...
分类:
其他好文 时间:
2014-07-08 18:25:05
阅读次数:
256
Description
During winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, comes out, and begins its new life.
Hol...
分类:
其他好文 时间:
2014-07-08 17:28:54
阅读次数:
256
Description
Let’s play a puzzle using eight cubes placed on a 3 × 3 board leaving one empty square.
Faces of cubes are painted with three colors. As a puzzle step, you can roll one of the cubes ...
分类:
其他好文 时间:
2014-07-08 16:27:42
阅读次数:
220
HDU 4771 Stealing Harry Potter's Precious
题目链接
题意:给定人的起始位置和k个宝物,求人拿完全部宝物最小的步数
思路:先bfs打出两两之间路径,然后dfs暴力求答案,因为宝物才4个,所以暴力是没问题的
代码:
#include
#include
#include
#include
using namespace st...
分类:
其他好文 时间:
2014-07-08 15:58:25
阅读次数:
181
Cake
Time Limit: 1 Second
Memory Limit: 32768 KB
You want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for th...
分类:
其他好文 时间:
2014-07-08 15:36:15
阅读次数:
298
题目链接:hdu 4771 Stealing Harry Potter's Precious
题目大意:在一个N*M的银行里,贼的位置在’@‘,现在给出n个宝物的位置,现在贼要将所有的宝物拿到手,问最短的路径,不需要考虑离开。
解题思路:因为宝物最多才4个,加上贼的位置,枚举两两位置,用bfs求两点距离,如果存在两点间不能到达,那么肯定是不能取完所有的宝物。然后枚举取宝物的顺序,维护a...
分类:
其他好文 时间:
2014-07-08 14:47:59
阅读次数:
172