摘要: 本文转自这位大牛的博客http://blog.vckbase.com/panic/archive/2005/03/20/3778.html#NoteA*寻路初探 GameDev.net作者: Patrick Lester译者:Panic2005年3月18日译者序:很久以前就知道了A*算法,但是从未认真读过相关的文章,也没有看过代码,只是脑子里有个模糊的概念。这次决定从头开始,研究一下这个被人推崇备至的简单方法,作为学习人工智能的开始。这篇文章非常知名,国内应该有不少人翻译过它,我没有查找,觉得翻译本身也是对自身英文水平的锻炼。经过努力,终于完成了文档,也明白的A*算法的原理。毫无疑问,作者用形 阅读全文
posted @ 2011-04-09 22:17 c++fans 阅读(1673) 评论(2) 推荐(0) 编辑
摘要: 线段树的基本操作,具体看代码注释。View Code #include <iostream>#include <string>using namespace std;const int MAX = 50005; struct Tree{ int left; int right; int num;}tr[MAX*3];int arr[MAX],n,t,a,b,ans;string cmd;void build(int l,int r,int now) // 构造线段树{ tr[now].left = l; tr[now].right = r; if(l == r) {tr 阅读全文
posted @ 2011-04-09 13:11 c++fans 阅读(293) 评论(0) 推荐(1) 编辑