摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2918思路:这道题与前面几道类似,可以说是被秒杀了!!!构造启发式函数h()=(cnt+3)/4(cnt为不在位的点的个数)。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int map[4][4]; 8 char str[14]; 9 int max_deep; 10 11 int Get_H() 12 { 13 int cnt=0; 14 for(int i=1... 阅读全文
posted @ 2013-09-18 11:09 ihge2k 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1813思路:首先bfs预处理出‘0’到边界点最短距离,然后构造 h() 为所’0‘点逃离迷宫的最少步数的最大值。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define inf 1PP; 9 10 struct Node{ 11 int x,y; 12 }node[44]; 13 14 char str[11][11]; 15 int map[11][1... 阅读全文
posted @ 2013-09-18 10:17 ihge2k 阅读(266) 评论(0) 推荐(0) 编辑