![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
文章平均质量分 77
lasolmi
这个作者很懒,什么都没留下…
展开
-
【搜索进阶】hdu 1043 Eight
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1043 A*: 因为每次移动都会影响一个点的曼哈顿距离(不算x),构造h()为所有数字块的曼哈顿距离和,用逆序数hash(算x),根据逆序数奇偶性(不算x)减掉无法到达的情况;在构造优先队列时当f相同时按照g值从大到小排序,这样又是一个很给力的减枝原创 2014-08-28 22:27:21 · 670 阅读 · 0 评论 -
【搜索进阶】HDU 1667 The Rotation Game
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1667 IDA*的入门题目,状态过多容易超内存,正好体现了IDA*的优势,每次操作移动能使一个数字进入中间的八个位置,所以构造h()=8-max(1,2,3在中间8个位置的个数)原创 2014-08-28 22:31:18 · 474 阅读 · 0 评论 -
【搜索进阶】HDU 2234 无题I
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2234 IDA*:每次移动改变四个点的位置,即h()=(最少可能的横向或纵向不在位置上的点的个数+3)/4 ) #include #include using namespace std; char maze[5][5]; inline void roL(int x){ char t=maz原创 2014-08-28 22:35:55 · 610 阅读 · 0 评论 -
【搜索进阶】HDU 1560 DNA sequence
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1560 IDA*: 容易看出最少步数肯定是大于等于最大字符长度的,所以就构造 h() 为所有剩余长度的最大值原创 2014-08-28 22:37:31 · 410 阅读 · 0 评论 -
【搜索进阶】HDU 1813 Escape from Tetris
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1813 IDA*:求出某个位置逃出的最少步数,然后在构造 h() 为所有点逃离迷宫的最少步数的最大值原创 2014-08-28 22:41:01 · 509 阅读 · 0 评论 -
【搜索进阶】HDU 3459 Rubik 2×2×2
#include #include using namespace std; char maze[10][10]; void cvrX(){ char tmp; tmp=maze[0][3]; maze[0][3]=maze[3][6]; maze[3][6]=maze[4][3]; maze[4][3]=maze[2][3]; maze[2][3]=tmp;原创 2014-08-28 22:47:44 · 711 阅读 · 0 评论 -
【搜索进阶】POJ 2449 Remmarguts' Date K短路
题目链接: #include #include #include #include #include #include using namespace std; const int maxn = 1001; #define inf (1<<29) struct nod{ int x,val; nod() {} friend bool operator < (c原创 2014-08-29 10:21:42 · 439 阅读 · 0 评论