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. Swift中的循环语句

    循环语句能够使程序代码重复执行.Swift编程语言支持4种循环构造类型:while.do while.for和for in.for和while循环是在执行循环体之前测试循环条件,而do while是在 ...

  2. 使用Emmet(前身Zen Coding)加速Web前端开发

    Emmet插件以前被称作为Zen Coding,是一个文本编辑器的插件,它可以帮助您快速编写HTML和CSS代码,从而加速Web前端开发.早在2009年,Sergey Chikuyonok写过一篇文章 ...

  3. 判断DataReader中是否有指定列

    取出的DataReader如果在读取过程中报没有列的错误可以用这个方法. //调用该方法判断datareader中是否有指定列 public static bool readerExists(IDat ...

  4. 32位系统下使用4GB内存

    64位系统的驱动还有不少缺陷,果断重装回32位系统,但是4gb的内存,明显是浪费啊. 所以必须利用起来. 我没有采用不稳定的破解内核的做法,采用了虚拟硬盘的做法.因为个人觉得这样其实利用效率更高. 方 ...

  5. JavaScript 函数的执行过程

    每一个JavaScript函数都是Function对象的一个实例, 它有一个仅供JavaScript引擎存取的内部属性[[Scope]]. 这个[[Scope]]存储着一个作用域的集合, 这个集合就叫 ...

  6. 【leetcode】354. Russian Doll Envelopes

    题目描述: You have a number of envelopes with widths and heights given as a pair of integers (w, h). One ...

  7. Bugzilla+MySql+IIS+ActivePerl搭建指南

    头在忙着他的技术研究,对团队建设.测试管理.流程规范都不怎么理会,眼见着产品进入后期整合阶段,在测试过错中出现很多Bug,单靠着我一个人用txt来收集整理bug需求,然后整理成word,放在svn上面 ...

  8. 【转】JavaScript中undefined与null的区别

    通常情况下, 当我们试图访问某个不存在的或者没有赋值的变量时,就会得到一个undefined值.Javascript会自动将声明是没有进行初始化的变量设为undifined. 如果一个变量根本不存在会 ...

  9. 2014-10 u-boot 顶层config.mk分析

    /** ****************************************************************************** * @author    Maox ...

  10. php parallel

    http://www.phpied.com/simultaneuos-http-requests-in-php-with-curl/ http://stackoverflow.com/question ...