码迷,mamicode.com
首页 >  
搜索关键字:tower of hanoi    ( 471个结果
数据结构常用算法
//汉诺塔 void Hanoi(int n,string A,string B,string C){ if(n == 1) cout"<<C<<endl; else{ Hanoi(n-1,A,C,B); cout"<<C<<endl; Hanoi(n-1,B,A,C); } } //递归实现 int maxNUm(int num[],int n){ if(1 ==...
分类:其他好文   时间:2014-08-29 11:03:07    阅读次数:174
UVA - 12119 The Bells are Ringing (枚举)
Description   Perhaps you all have heard the mythical story about Tower of Hanoi (The details of this story is not required to solve this problem): ?There is a tower of Hanoi with 64 disks and ...
分类:其他好文   时间:2014-08-26 17:33:56    阅读次数:309
UVa 10051 Tower of Cubes(DP 最长立体堆叠)
?? 题意  给你n个立方体  立方体每面都涂有颜色  当一个立方体序号小于另一个立方体且这个立方体底面的颜色等于另一个立方体顶面的颜色  这个立方体就可以放在另一个立方体上面  求这些立方体堆起来的最大高度; 每个立方体有6种放置方式  为了便于控制  个人喜欢将一个立方体分解为6个  这样每个立方体只用考虑顶面和底面   d[i]表示分解后以第i个立方体为基底可以达到的最大高度  j从1到...
分类:其他好文   时间:2014-08-26 09:53:55    阅读次数:237
HDU_4939 stupid tower defense 2014多校7 多变量型DP
意思是有个塔防游戏,有三种塔,红塔在怪物经过的时候每秒会产生攻击力大小的伤害,绿塔对怪物经过以及经过之后每秒产生攻击力大小的伤害,还有种蓝塔,对怪物进行减速,即怪物从此之后经过一个单位都会减慢c秒最后最最大的伤害值是多少又是比赛的时候没想出来,知道是个DP,但是对这种多变量型的DP就是有点不感冒。这...
分类:其他好文   时间:2014-08-24 19:16:22    阅读次数:190
UVa 437 The Tower of Babylon(DP 最长条件子序列)
?? 题意  给你n种长方体  每种都有无穷个  当一个长方体的长和宽都小于另一个时  这个长方体可以放在另一个上面  要求输出这样累积起来的最大高度 因为每个长方体都有3种放法  比较不好控制   可以把一个长宽高分成三个长方体  高度是固定的  这样就比较好控制了 #include #include #include using namespace std; ...
分类:其他好文   时间:2014-08-23 11:21:40    阅读次数:191
UVA 437 The Tower of Babylon
题意:给n种立体块,每种有无限个,上面的块长宽必须小于下面的块,问最多可以搭建多高 思路:输入的时候小小处理下,把每个块各条边当高的情况存入结构体中,按升序排序,然后dp,比较求出最大值。。看好多代码都说什么最长上升子序列,感觉没有用到额,LIS的标记数组是用来存储相应长度的最小值的,没看出来哪里用上了额。。。数据范围小,直接就是dp了=。= #include #include #...
分类:其他好文   时间:2014-08-20 22:47:03    阅读次数:253
HDU 4939 Stupid Tower Defense
dp;枚举red,dp前i 个塔中有j 个蓝塔的最大伤害。机智的地方:dp前i 个塔的时候可以同时处理n-i 个红塔,这样就少了个循环。。。(枚举红塔的循环) 1 #include 2 #include 3 #include 4 using namespace std; 5 6 long l...
分类:其他好文   时间:2014-08-19 12:23:24    阅读次数:179
One usage of recurison: the tower of Hanoi
Statements: This blog was written by me, but most of content  is quoted from book【Data Structure with Java Hubbard】  【Description】   we have seen important examples of functions that are more n...
分类:其他好文   时间:2014-08-17 01:09:11    阅读次数:186
多校第七场 DP+map模拟
HDU 4939  Stupid Tower Defense DP 推一下。 #include #include #include #include #include #include #include #include #include #include #include typedef long long LL; using namespace std; LL dp[1505][1505]...
分类:其他好文   时间:2014-08-16 12:38:20    阅读次数:171
HDU4939:Stupid Tower Defense(DP)
Problem Description FSF is addicted to a stupid tower defense game. The goal of tower defense games is to try to stop enemies from crossing a map by building traps to slow them down and towers whic...
分类:其他好文   时间:2014-08-15 14:42:48    阅读次数:188
471条   上一页 1 ... 41 42 43 44 45 ... 48 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!