
搜索
文章平均质量分 79
birdforever
我是一个纯粹的人,生不带来,死不带走,只为无怨无悔地活一次!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 1101 The Game
<br />//poj 1101 The Game 搜索 <br />/* <br />题意:在一个矩形地图上,从一个'X'到另一个'X',途中不经过其他'X'并可以跨出地图范围,<br /> 求到另一个‘X' 的线段数最短的路径。这里的线段只可能是横向或竖向。<br />题解:直接搜索就行,用一个参数记录当前点是从哪个方向来,如果继续搜索的方向改变了,<br /> 线段数就加一,最后输出最少的线段数就行了。<br />*/<br />#include <iostream><br />原创 2010-08-24 23:31:00 · 749 阅读 · 0 评论 -
poj 1324 Holedox Moving
<br /><br /> <br />//poj 1324 Holedox Moving 贪食蛇(bfs+剪枝)<br />/* <br />题解:http://blog.sina.com.cn/s/blog_520db5ec0100coqb.html<br />上面这位哥们的题解够详细了,运用了他的那个剪枝就不会超时(近1000MS).<br />PS: 广搜+剪枝的题是最让我头疼的题,这道题搞了一个下午。<br /> 剪枝的灵感一般都来源于题目本身的特殊性,这道贪食蛇的<br />原创 2010-08-26 00:27:00 · 1383 阅读 · 1 评论 -
poj 1040 Transportation
<br />//poj 1040 Transportation (搜索+剪枝) /* 题解:排序,所有order从左到右搜,决定选或不选 PS:一个小小剪枝产生的效果大极了,剪枝前TLE,剪枝后200多MS */ #include <iostream> #include <algorithm> #include <cmath> using namespace std; const int inf = 1<<28; int n,m; int c,ans,mark; struct原创 2010-09-09 22:48:00 · 1026 阅读 · 0 评论 -
poj 1011 Sticks
<br />//poj 1011 经典搜索题<br />//http://www.cnblogs.com/eclipse9614/archive/2010/05/24/POJ1011.html<br />//这位老兄解题报告的第三点是最强力的,不过要配合其他剪枝才能过,0MS。。。<br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />int n,sum;<br />int len[70];<br原创 2010-09-02 16:09:00 · 566 阅读 · 0 评论 -
poj 1077 Eight
// poj 1077 Eight /* 普通的广搜题,因为忘了标记爆了好多次空间,吸取教训! */ #include #include #include using namespace std; const int inf = 1=0 && v=0 && w原创 2010-09-05 10:45:00 · 640 阅读 · 0 评论 -
poj 1189 钉子和小球
<br /> //poj 1189 钉子和小球 记忆搜索 /* 题意:基于DP的思想,每一个位置(i,j)的球可能来自三个地方(如果存在):(i-1,j-1),(i-1,j),(i-2,j-1), 递归算出三个地方的概率再加起来就行了。 PS:此题加深了我对大数乘法溢出的警戒心。 */ #include <iostream> using namespace std; const int inf = 1<<28; int n,m,k; char str[1000000];原创 2010-09-06 00:25:00 · 892 阅读 · 0 评论 -
poj 1021 2D-Nim
<br />// poj 1021 2D-Nim<br />/* <br />别看它名字,其实这题跟Nim游戏一点关系都没有,是判断棋盘上两个连通分支(经过翻转、镜像后)是否等价 <br />做了本题才知道可以用hash来判断,不然可能真的要八种情况都考虑 ,那样会写死人。。。hash方法很巧妙,见代<br />码 ,本题 0 Ms(数据太弱),再接再厉!<br />*/ <br />#include <iostream><br />#include <algorithm><br />using names原创 2010-09-04 01:23:00 · 1657 阅读 · 0 评论