
搜索
文章平均质量分 64
Davenny
O ever youthful,O ever weeping.
展开
-
poj 2286 (自己对IDA*的一些理解)
原博客地址:http://blog.youkuaiyun.com/t1019256391/article/details/925724315s的时间,150000kb的内存,一眼就让人想到广搜,但状态实在太多,3^25-1种吧,想写又没下手。。。其实这是一道IDA*的题目。顺便讲一下自己对IDA*的理解:1、什么是IDA*? 是结合深搜和广搜二者优势的一种算法,深搜内存消耗少,路径容易保存,状态少,但不能保证最转载 2017-07-11 09:01:02 · 578 阅读 · 0 评论 -
hdu3533bfs+预处理
The students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. The blue army finds that Little A is the spy of the red army, so Little A has to原创 2017-09-01 14:33:37 · 355 阅读 · 0 评论 -
hdu 5024搜索
题目大意; 在一个地图上寻找最远的两点使得这两点的路径中最多只有一个直角转弯,‘.’的地方可走,’#’的地方不可走 思路: 刚开始还想着从每个点开始深搜,毫无疑问的超时了; 然偶胡看了别人的博客才知道,由于要的是形成直角,所以直线方向上的不同向均形成直角,同理在斜线方向上也是这样;然后枚举没一点的八个方向,将不同方向上的值加起来的最大值即为所求;#include <cstdio>#incl原创 2016-10-31 16:26:44 · 355 阅读 · 0 评论 -
hdu4634:bfs+状压
Description “Swipe Bo” is a puzzle game that requires foresight and skill. The main character of this game is a square blue tofu called Bo. We can swipe up / down / left / right to move Bo up / down原创 2016-08-10 15:27:36 · 357 阅读 · 0 评论 -
poj1511:spfa+邻接表(自己模拟)
题目大意: 从1到N分别给出两点之间的有向图,然后让你求,从一到个点的最短路,以及从个点回到1的最短路之和;思路: 由于边非常多,采用邻接表并且自己模拟(头插入,用VECTER会超时); 刚开始还想着正向从一开始搜,反向从N开始搜,然而错了!!!反向从N开始搜的是从N到个点的最短路,而不是从个点到1的最短路!!! 所以需要建立一个正向图和一个反向图,均从1开始搜就可以得到结果;#includ原创 2016-08-17 19:28:37 · 336 阅读 · 0 评论 -
DFS:poj:2918 数独
题目大意: 9X9矩阵,要求:1,横行,竖行为1-9不能有重复 2,将其划分为3X3的九宫格,每个分格也是1-9不能有重复; 给你残缺的九宫格,让你将其填满;啊,比赛的时候死调都没有调出来,后来。。。过了一天再来看,终于让我调出来了;思路: 状态压缩(实际上不用状态压缩要快一些);将横行竖行和每个格子的九个数字状态压缩成一个数字,数字的九个原创 2016-08-19 15:18:50 · 302 阅读 · 0 评论 -
广搜:吃豆子
Description 吃豆人是一款非常经典的游戏,游戏中玩家控制吃豆人在地图上吃光所有豆子,并且避免被怪物抓住。这道题没有怪物,将游戏的画面分成n*m的格子,每格地形可能为空地或者障碍物,吃豆人可以在空地上移动,吃豆人每移动一格需要1s时间,并且只能朝上下左右四个方向移动,特别的是吃豆人还能吐出舌头,舌头每移动一格需要0.1s时间,舌头只可以走直线。不必考虑吃豆人转身所需要的时间。举例,吃豆人在转载 2016-07-29 16:47:59 · 379 阅读 · 0 评论 -
*dfs: Cannon
Description In Chinese Chess, there is one kind of powerful chessmen called Cannon. It can move horizontally or vertically along the chess grid. At each move, it can either simply move to another empt原创 2016-08-03 13:48:59 · 318 阅读 · 0 评论 -
爆搜
Description XCOM-Enemy Unknown是一款很好玩很经典的策略游戏. 在游戏中,由于未知的敌人–外星人入侵,你团结了世界各大国家进行抵抗. 随着游戏进展,会有很多的外星人进攻事件.每次进攻外星人会选择3个国家攻击,作为联盟的指挥者,你要安排有限的联盟军去支援其中一个国家,抵抗进攻这个国家的外星人. 战斗胜利之后这个被支援的国家恐慌值就会-2点 (恐慌值最少减为1),而其他转载 2016-07-18 20:44:31 · 393 阅读 · 0 评论 -
BFS:森林着火
Description input input.txt output output.txt After a terrifying forest fire in Berland a forest rebirth program was carried out. Due to it N rows with M trees each were planted and the rows were原创 2016-07-20 14:55:58 · 577 阅读 · 2 评论 -
dfs:How Many Equations Can You Find
Description Now give you an string which only contains 0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9.You are asked to add the sign ‘+’ or ’-’ between the characters. Just like give you a string “12345”, you can work o原创 2016-07-03 12:27:09 · 701 阅读 · 0 评论 -
dfs:N皇后问题
Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output 共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sam原创 2016-07-03 14:24:57 · 321 阅读 · 0 评论 -
dfs:Knight's Journey
Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two原创 2016-07-03 19:58:05 · 270 阅读 · 0 评论 -
dfs:Sum It Up
Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], then there原创 2016-07-03 20:08:00 · 339 阅读 · 0 评论 -
dfs:生日蛋糕
Description 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱。当i < M时,要求Ri > Ri+1且Hi > Hi+1。 由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。 令Q = Sπ原创 2016-07-04 09:49:18 · 349 阅读 · 0 评论 -
hdu3085双向bfs+曼哈顿距离判断
Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maze. They will kill the pe原创 2017-09-01 17:06:26 · 512 阅读 · 0 评论