自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(8)
  • 收藏
  • 关注

原创 poj1840 map + hash

题意:输入五个范围在-50~50的系数,求一个五元三次方程有多少组解,解的范围也是-50~50。 做法:遍历方程的前两项,将值存到hash表中,再遍历后三项,看得到的值的相反数是否在hash表中。 我用map   hash,效率较低。 #include #include using namespace std; typedef map M_TYPE; const int n =

2011-11-30 14:59:47 1556

原创 poj3274 hash

怎么hash网上已经说得很清楚,我就不多说了。 我看的这个博客: http://hi.baidu.com/aconly/blog/item/9d1ed1122a29af876538db0b.html 直接贴一下我的代码, 也有一些我做的过程中遇到的问题: #include #include #include using namespace std; #define K 33 #d

2011-11-29 12:48:44 675

原创 poj3026 bfs + Prim

对每一个人'用一次BFS,记录其他人与他的距离,并建图。 图建好后,用Prim求最小生成树即为答案。 #include #include #include using namespace std; #define M 105 #define VN 2500 #define INF 1000000000 int map[M][M], dist[M][M], que_x[VN], q

2011-11-28 10:26:10 1262

原创 poj2109 高精度+二分

代码1:discuss中的代码   #include #include #include using namespace std; int main() { double n,m; while(scanf("%lf%lf",&n,&m)==2) printf("%.0lf\n",pow(m,1/n)); return 0; }

2011-11-25 18:46:27 2689 1

原创 广义表建树

简单的广义表建树,但是却纠结了几个小时,总之是太囧了。。。代码还很糟糕。。。 不过也记录一下,或许以后还是用得上。 殷人昆数据结构 5.37 题 代码: #include using namespace std; #define ADD 5 struct treeNode { char val; treeNode * son, * next; }; bool isLette

2011-11-23 21:06:30 2060 1

原创 poj1190 生日蛋糕 (搜索剪枝)

网上很多解题报告,基本一个样,我就不画蛇添足了。 推一下第三个剪枝:如题, n为总体积, sumv为从下向上前k-1层的总体积,h为高,r为半径,ans为已经获得的最优的方案 易得:n - sumv = h[ k ] * ( r[ k ] ^ 2 ) + h[ k + 1 ] * ( r[ k + 1 ] ^ 2 )…… + h[ m ] * ( r[ m ] ^ 2 )

2011-11-04 23:13:25 4173

原创 poj1011 sticks

我的第一道搜索剪枝的题目。 题意:有一些 木棍,它们的长度相同。现在将木棍折断,最多折成64根。 编程求木棍可能的最小长度。 #include #include using namespace std; #define N 70 int stick[N], n; bool used[N]; bool compare(const int &a, const int &b) { re

2011-11-04 22:48:53 569

原创 poj1012 约瑟夫环

纠结。。。。 不想写思路了,看这个博客的吧。 http://hi.baidu.com/c4pt0r/blog/item/a3bdd0514f77852642a75b9f.html 贴代码: #include using namespace std; #define K 15 int k; bool solve(int m) { int p = 1, rest = 2 * k

2011-11-04 21:57:54 589

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除