
ACM-搜索策略
yew1eb
https://github.com/yew1eb
展开
-
hdu1239 Calling Extraterrestrial Intelligence Again (枚举)
Calling Extraterrestrial Intelligence AgainA message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of Saturday November 16, 1974. The message consisted of 1679 bits and was meant原创 2013-07-15 21:40:26 · 2139 阅读 · 0 评论 -
hdu 1664 Different Digits, spoj 3929 , 同余,bfs
Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 820 Accepted Submission(s): 202Problem DescriptionGiven a positive integer n, yo原创 2014-12-02 23:22:16 · 2147 阅读 · 0 评论 -
hdu 5113 Black And White, 黑白染色,技巧
Black And WhiteTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 485 Accepted Submission(s): 131Special JudgeProblem Description原创 2014-12-03 00:50:23 · 3016 阅读 · 0 评论 -
hdu1043 Eight (八数码问题,多种解法)
hdu1043 :http://acm.hdu.edu.cn/showproblem.php?pid=1043八数码问题 有一个3*3的棋盘,其中有0-8共9个数字,0表示空格,其他的数字可以和0交换位置。求由初始状态到达目标状态 123 456 780 的步数最少的解?有多组数据解法:1、反向BFS + hash( cantor展开 )因为状态总原创 2014-02-19 15:16:04 · 4310 阅读 · 0 评论 -
poj 1190 生日蛋糕 , 强剪枝
题意:制作一个体积为Nπ(N设从下往上数第i(1 Ri+1且Hi > Hi+1。 由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。 令Q = Sπ 请编程对给出的N和M,找出蛋糕的制作方案(适当的Ri和Hi的值),使S最小。 (除Q外,以上所有数据皆为正整数) 分析:表面积只和底面圆面积和各层侧面积有关原创 2014-07-12 14:52:32 · 1937 阅读 · 0 评论 -
hdu1010 Tempter of the Bone(剪枝)
Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 51440 Accepted Submission(s): 13834Problem DescriptionThe原创 2013-07-15 21:55:43 · 1915 阅读 · 0 评论 -
poj 1011 Sticks ,剪枝神题
木棒Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 118943 Accepted: 27429Description乔治拿来一组等长的木棒,将它们随机地砍断,使得每一节木棍的长度都不超过50个长度单位。然后他又想把这些木棍恢复到为裁截前的状态,但忘记了初始时有多少木棒以及木棒的初始长度。请你设计一个程序,帮助乔治原创 2014-07-12 15:14:36 · 1858 阅读 · 0 评论 -
DLX题集
FZU 1686神龙的难题HDU1426 Sudoku KillerHDU1530Maximum Clique HDU1603A Puzzling ProblemHDU2119MatrixHDU2295RadarHDU2518Dominoes原创 2014-04-08 09:11:59 · 2178 阅读 · 0 评论 -
A*算法入门
原作者文章链接:http://www.policyalmanac.org/games/aStarTutorial.htm启发式搜索:启发式搜索就是在状态空间中的搜索对每一个搜索的位置进行评估,得到最好的位置,再从这个位置进行搜索直到目标。这样可以省略大量无畏的搜索路径,提到了效率。在启发式搜索中,对位置的估价是十分重要的。采用了不同的估价可以有不同的效果。估价函数:从当前节点移原创 2014-07-31 10:11:11 · 6359 阅读 · 1 评论 -
POJ1729 Jack and Jill (双向广度优先搜索, DBFS)
loading原创 2014-02-19 15:32:12 · 3463 阅读 · 1 评论 -
hdu1026 Ignatius and the Princess I BFS
http://acm.hdu.edu.cn/showproblem.php?pid=1026Ignatius and the Princess ITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9535 A原创 2013-07-21 14:31:47 · 1629 阅读 · 0 评论 -
hdu1195 Open the Lock(BFS)
http://acm.hdu.edu.cn/showproblem.php?pid=1195BFS三个方向:加1,减1,相邻交换,其中9+1=1,1-1=9,最左边不与最右边相邻code:#include#include#include#include#include#includeusing namespace std;int visit[11][11]原创 2013-07-21 14:25:17 · 1549 阅读 · 0 评论 -
hdu 2616 Kill the monster(深搜)
http://acm.hdu.edu.cn/showproblem.php?pid=2616题意:有n种技能,每种技能只能用一次,怪物有m点血,问最少需要多少种技能可以把怪物杀死。每种技能有两个数值a和b,a表示攻击力,b表示当怪物的血量小于等于b时,这种技能的攻击力可以变为2a。一点攻击力可以杀掉怪物一点血。 简单深搜原创 2013-07-19 00:50:50 · 2370 阅读 · 0 评论 -
hdu1518 Square | ZOJ1909 | POJ2362 (dfs + 剪枝)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1518题意:给你n根木棒,问用光所有的木棒能否拼成正方形。dfs剪枝: 1、当搜到三条边的时候,第四条边也就确定了。这时就找到解了,可以停止搜索了。 2、由于每一根木棒都要使用,所以在搜第一条边的时候可以直接拿第一根木棒作为这条边的头一根木原创 2013-07-19 08:26:28 · 1870 阅读 · 0 评论 -
poj1573 Robot Motion (模拟)
http://poj.org/problem?id=1573大意:模拟一个机器人在特定的棋盘中行走,每个棋盘的格子规定好了机器人移动的方向,每次移动只能走一个格子,问机器人退出棋盘是走的步数,如果不能退出棋盘,输出机器人进入循环前走的步数和每次循环中包含的步数。简单模拟#include #include #include using namespace原创 2013-07-19 08:38:29 · 1667 阅读 · 0 评论 -
hdu2514 Another Eight Puzzle (全排列、暴力)
http://acm.hdu.edu.cn/showproblem.php?pid=2514n = 8, 我直接用了next_permutation 全排列 , 然后对每一个排列进行即可。#include #include #include using namespace std;int a[10];int b[10];int ans[10];int p原创 2013-07-19 08:44:09 · 1869 阅读 · 0 评论 -
poj 1564 Sum It Up | zoj 1711 | hdu 1548 (dfs + 剪枝 or 判重)
Sum It UpTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4 Accepted Submission(s) : 1Font: Times New Roman | Verdana | GeorgiaFo原创 2013-07-17 13:57:42 · 2599 阅读 · 0 评论 -
poj3278Catch That Cow(BFS)
Catch That CowTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 37094 Accepted: 11466DescriptionFarmer John has been informed of the location of a fugitiv原创 2013-07-17 15:30:14 · 1745 阅读 · 0 评论 -
hdu 1548 A strange lift (BFS、Dijkstra)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1548题意: 有一个特别的电梯,第i层有一个对应的数字ki, 对于第i层按上升键up可升上到i+k[i]层,按下降键down到达i-k[i]层,到达的楼层最高不能超过n层,最低不能小于1层。给你一个起点A和终点B,问最少要按几次上升键或者下降键到达目的地,不可达则原创 2013-07-18 20:48:29 · 1758 阅读 · 0 评论 -
hdu1242 Rescue(BFS +优先队列 or BFS )
http://acm.hdu.edu.cn/showproblem.php?pid=1242题意: Angel被传说中神秘的邪恶的Moligpy人抓住了!他被关在一个迷宫中。迷宫的长、宽不超过200。 迷宫中有不可以越过的墙以及监狱的看守。 Angel的朋友带了一些救援队来到了迷宫中。他们的任务是:接近Angel。我们假设接近Angel就是到达Angel所在的位置。假设移原创 2013-07-21 13:37:12 · 2563 阅读 · 0 评论 -
hdu1072 Nightmare (BFS)
http://acm.hdu.edu.cn/showproblem.php?pid=1072NightmareTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5438 Accepted Submission原创 2013-07-21 14:21:16 · 1669 阅读 · 0 评论 -
搜索练习题集
http://www.cnblogs.com/ambition/archive/2011/07/25/search_plus.html HDU3663 搜索,DLXhttp://blog.youkuaiyun.com/yihuikang/article/details/8092172HDU4778 搜索,alpha-betahttp://blog.youkuaiyun.com/waitfor_/a原创 2013-07-18 19:55:20 · 3017 阅读 · 2 评论