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种 ...
随机推荐
- Linux远程管理
若想要远程管理服务器,对于Windows系统,应该比较容易理解,通过window系统自带的远程桌面客户端即可登录远程服务器,从而实现在本地对远程服务器的管理.然而对于linux服务器来说这种方法就不行 ...
- 物料BOM和生产订单BOM的区别
物料BOM和生产订单BOM的区别[@more@] 一般企业生产部在SAP创建生产订单的时候,就会产生一个生产订单BOM,这里的生产订单BOM是读取的物料BOM. 由于其它原因,需要修改成品的某几个零部 ...
- 在IIS7.5打开网页的时候,提示: HTTP 错误 500.0 - Internal Server Error 调用 LoadLibraryEx 失败,在 ISAPI 筛选器 "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll" 上。解决方法
- 解决requestAnimationFrame的兼容问题
写法: window.requestAnimFrame = (function () { return window.requestAnimationFrame || window.webkitReq ...
- CentOS中输入yum报错:sudo: unable to execute /bin/yum: No such file or directory
今天尝试更新了下虚拟机CentOS中的python版本后. 运行“yum”命令,就报错:“sudo: unable to execute /bin/yum: No such file or direc ...
- js TAb
有点乱,用到了自定义getByClass函数.sibling函数 <!DOCTYPE html> <html lang="en"> <head> ...
- nyoj------20吝啬的国度
吝啬的国度 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 在一个吝啬的国度里有N个城市,这N个城市间只有N-1条路把这个N个城市连接起来.现在,Tom在第S号城市 ...
- MATLAB 随机生成互不重叠的多个矩形
建立m文件draw_rectangle.m. 其中p生成矩形的个数 function draw_rectangle(p) t = 1; x = rand(1)*10; y = rand(1)*10; ...
- windows系统下Tomcat与Apache服务器集成
说明:此文是看书真实试验成功的,书中提到了不同版本不兼容的问题,但是很荣幸我没碰到,此例可供参考. 本文假设你已经有了java环境和tomcat,你已经熟悉tomcat的应用. Jdk 1.7.0_5 ...
- css样式书写的问题
经常遇到前端的朋友问及css样式书写的问题,结合自己实际的工作,自己总结了整理了一下,给大家分享: 一.顺序问题:显示属性-位置属性-元素自身属性-文本属性-其他属性 1.显示属性:z-index.d ...