dp  将石块按三个面存入队列  按底面积排序  dp就最大高度  按嵌套矩形最长路做做法

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std;
struct tone
{
int x,y,z;
void t(int a, int b, int c)
{
x = a;
y = b;
z = c;
}
};
bool cmp(tone q, tone p)
{
return q.x*q.y < p.x*p.y;
}
tone tt[100];
int dp[101];
int main()
{
int n;
int ca = 1;
while(scanf("%d",&n) && n)
{
int k = 0;
for(int i = 0; i < n; i++)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
tt[k++].t(a,b,c);
tt[k++].t(b,c,a);
tt[k++].t(c,a,b);
}
sort(tt, tt+k, cmp);
int _max = 0;
for(int i = 0; i < k; i++)
{
dp[i] = tt[i].z;
for(int j = 0; j < i; j++)
{
if((tt[i].x > tt[j].x && tt[i].y > tt[j].y) || (tt[i].x > tt[j].y && tt[i].y > tt[j].x))
{
dp[i] = max(dp[i], dp[j]+tt[i].z);
}
}
_max = max(_max, dp[i]);
}
printf("Case %d: maximum height = %d\n", ca++, _max);
}
return 0;
}

uva 437 hdu 1069的更多相关文章

  1. HDU 1069 dp最长递增子序列

    B - Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  2. HDU 1069&&HDU 1087 (DP 最长序列之和)

    H - Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format: ...

  3. HDU 1069 Monkey and Banana(二维偏序LIS的应用)

    ---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  4. UVA 437 十九 The Tower of Babylon

    The Tower of Babylon Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Subm ...

  5. 怒刷DP之 HDU 1069

    Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  6. HDU 1069 Monkey and Banana (DP)

    Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. 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 ...

  8. (最大上升子序列)Monkey and Banana -- hdu -- 1069

    http://acm.hdu.edu.cn/showproblem.php?pid=1069      Monkey and Banana Time Limit:1000MS     Memory L ...

  9. hdu 1069 动规 Monkey and Banana

     Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u ...

随机推荐

  1. Linux C编程--main函数参数解析

    我们经常用的main函数都是不带参数的.因此main 后的括号都是空括号.实际上,main函数可以带参数,这个参数可以认为是 main函数的形式参数.C语言规定main函数的参数只能有两个, 习惯上这 ...

  2. CDH离线安装之安装包下载地址

    cloudermanager安装包地址:http://archive.cloudera.com/cm5/cm/5/cloudera-manager-el6-cm5.3.0_x86_64.tar.gz, ...

  3. Jquery插件的编写和使用

    第七章 Jquery插件的编写和使用    插件的定义: 插件也称为扩展,是一种遵循一定规范的应用程序接口编写出来的程序. 下面是Jquery插件的编写很使用:要查看请点击:Jquery插件的编写很使 ...

  4. jQuery mouseenter与mouseleave

    mouseenter: 定义和用法 当鼠标指针穿过元素时,会发生 mouseenter 事件. 该事件大多数时候会与 mouseleave 事件一起使用. mouseenter() 方法触发 mous ...

  5. 抛弃 CSS Hacks 后的浏览器兼容方案

    一般情况下的浏览器兼容需要考虑 IE6/7/8 三种 IE 版本,当然在 IE9 开始逐步推向市场后,又会有更多的衍生版本.所以我目前只考虑 IE7~9 版本的兼容情况.涉及到的条件注释代码如下: & ...

  6. CAF(C++ actor framework)(序列化之类,无需序列化,直接传)(二)

    昨天讲了Struct,还是不够满意,毕竟C++里面类用的比较多嘛,那就先上个类, 这段代码是我稍微改编了一下的结果.都是最基本的用法. #include <utility> #includ ...

  7. awk!字符问题,修复中!.......

    awk '条件类型1{动作1} 条件类型2{动作2}' file1 file2 变量名称:1.NF 每一行($0表示文本所有域)拥有的字段数. 2.NR目前awk处理的"第n行"数 ...

  8. Spring MVC Controller中GET方式传过来的中文参数会乱码的问题

    Spring MVC controller 这样写法通常意味着访问该请求,GET和POST请求都行,可是经常会遇到,如果碰到参数是中文的,post请求可以,get请求过来就是乱码.如果强行对参数进行了 ...

  9. jQuery网页元素拖拽插件

    效果说明:配合已有CSS样式,载入插件后,网页元素可以随意在窗口内拖拽,设置了原位置半透明和拖拽半透明的效果选项,可根据需要选择.另外,当页面上有多个可拖拽元素时,可以载入另外一个用于设置z-inde ...

  10. DevExpress gridView 小结(一)

    一:第一列显示行号  CustomDrawRowIndicator this.gridViewDevice.IndicatorWidth = 40; this.gridViewDevice.Custo ...