hdu 1069
//Accepted 264 KB 0 ms //每种block只有三种方法,且每种放法至多放一次 //规定三条边的顺序后 //把所有的block按x递增排序,x相同则按y递增排序 //然后dp //dp[i]=max(dp[i],dp[j]+height[i]) i可以放到j上 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; ; struct node { int x,y,z; }p[*imax_n]; *imax_n]; int n; int max(int a,int b) { return a>b?a:b; } int min(int a,int b) { return a<b?a:b; } void Dp() { memset(dp,,sizeof(dp)); ;i<=*n;i++) { ;j<i;j++) if (p[j].x<p[i].x && p[j].y<p[i].y) dp[i]=max(dp[i],dp[j]+p[i].z); } ; ;i<=*n;i++) ans=max(ans,dp[i]); printf("%d\n",ans); } int cmp(struct node p1,struct node p2) { ; if (p1.x==p2.x) { ; } ; } int main() { ; while (scanf("%d",&n),n) { ;i<=n;i++) { int x,y,z; scanf("%d%d%d",&x,&y,&z); p[*i-].x=min(x,y); p[*i-].y=max(x,y); p[*i-].z=z; p[*i-].x=min(x,z); p[*i-].y=max(x,z); p[*i-].z=y; p[*i].x=min(y,z); p[*i].y=max(y,z); p[*i].z=x; } sort(p+,p+*n+,cmp); printf("Case %d: maximum height = ",++t); Dp(); } ; }
hdu 1069的更多相关文章
- HDU 1069 dp最长递增子序列
B - Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- HDU 1069&&HDU 1087 (DP 最长序列之和)
H - Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format: ...
- HDU 1069 Monkey and Banana(二维偏序LIS的应用)
---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- 怒刷DP之 HDU 1069
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 1069 Monkey and Banana (DP)
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 1069 Monkey and Banana / ZOJ 1093 Monkey and Banana (最长路径)
HDU 1069 Monkey and Banana / ZOJ 1093 Monkey and Banana (最长路径) Description A group of researchers ar ...
- (最大上升子序列)Monkey and Banana -- hdu -- 1069
http://acm.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit:1000MS Memory L ...
- hdu 1069 动规 Monkey and Banana
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u ...
- HDU 1069—— Monkey and Banana——————【dp】
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 1069 Monkey and Banana dp 题解
HDU 1069 Monkey and Banana 纵有疾风起 题目大意 一堆科学家研究猩猩的智商,给他M种长方体,每种N个.然后,将一个香蕉挂在屋顶,让猩猩通过 叠长方体来够到香蕉. 现在给你M种 ...
随机推荐
- Alpha
100% — FF95% — F290% — E685% — D980% — CC75% — BF70% — B365% — A660% — 9955% — 8C50% — 8045% — 7340% ...
- 【转】PackageInfo、ResolveInfo 笔记
1.PackageInfo.ResolveInfo PackageItemInfo:包含了一些信息的基类, 它的直接子类有: ApplicationInfo. ComponentInfo.Instru ...
- 串行通讯之.NET SerialPort
第1章串行通讯之.NET SerialPort 2 1 枚举串口 2 2 打开/关闭串口 2 3 写数据 3 3.1 写二进制数据 3 3.2 写文本数据 4 4 ...
- AOP 之 6.1 AOP基础(拾陆)
6.1.1 AOP是什么 考虑这样一个问题:需要对系统中的某些业务做日志记录,比如支付系统中的支付业务需要记录支付相关日志,对于支付系统可能相当复杂,比如可能有自己的支付系统,也可能引入第三方支付平 ...
- MySQL DELETE 表别名问题
- 纯css3代码写无缝滚动效果
主要用到css3中的动画 @keyframes, animation. 布局是外层一个div宽固定,然后overflow hidden 绝对定位,里面的ul 固定定位.通过对ul添加动画来实现效果.具 ...
- 为学Linux 我看了这些书
去年开始,抱着学习的态度开始了我的Linux学习,到现在,差不多一年了,收获很多,不敢说精通Linux,但是,还是对得起“略懂”这两个字的.这一年里我看了很多书,细细数下,大概15本左右,其中包含了两 ...
- Linux编程
头文件一般位于usr/include目录下,各个子类的头文件位于include子目录下 不知道某个“库函数”需要哪些头文件,使用“man 函数”即可查看 sys/types.h 基本系统数据类型 s ...
- python与unicode
Unicode是一种在计算机上使用的字符编码,是为了解决传统的字符编码方案的局限而产生的,它为每种语言中的每个字符设定了统一并且唯一的二进制编码,以满足跨语言.跨平台进行文本转换.处理的要求. Uni ...
- juery 选择器 选择多个元素
使用,号: $("#goodSource,#mailState") 选择了id为goodSource或者mailState的元素,当两者之间有任何一个有改变时,将会触发该操作. / ...