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. C#性能优化实践

    性能主要指两个方面:内存消耗和执行速度.性能优化简而言之,就是在不影响系统运行正确性的前提下,使之运行地更快,完成特定功能所需的时间更短. 本文以.NET平台下的控件产品MultiRow为例,描述C# ...

  2. HDOJ2008数值统计

    数值统计 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  3. Contoso 大学 - 6 – 更新关联数据

    原文 Contoso 大学 - 6 – 更新关联数据 By Tom Dykstra, Tom Dykstra is a Senior Programming Writer on Microsoft's ...

  4. zDialog无法获取未定义或 null 引用的属性“_dialogArray”

    zDialog无法获取未定义或 null 引用的属性"_dialogArray" 贴出错误:这个错误是从IE浏览器的控制台复制出来的. zDialog无法获取未定义或 null 引 ...

  5. node.js笔记——gulp

    1.全局安装 npm install gulp -g 2.安装到具体目录,并安装相应的自动化插件 npm install -save-dev gulp gulp-concat gulp-minify- ...

  6. Xml 学习

    XML概述 XML的历史背景 GML(1969):通用标记语言 IBM公司的一些专家们一起研究的一个课题: 软件必须有高度的可移植性,而且必须有一个统一的标准.为了实现软件的一处编写多处运行这个愿景所 ...

  7. FileZilla ftp服务器安装

    在官网下载server版本的FileZilla,我下载的是(The latest stable version of FileZilla Server is 0.9.41) 然后直接安装就可了,我由于 ...

  8. js 中的正则表达式

    一:正则表达式 定义:记录文本规则的代码 作用:表单验证,爬虫技术,可以对目标的内容进行替换. 二:正则表达式的组成 1:普通字符组成正则 浏览器的输出 2:定义字符集组成正则 3:特殊字符集组成正则 ...

  9. js异步收集

    http://www.cnblogs.com/rubylouvre/archive/2011/03/18/1984336.html http://www.cnblogs.com/hustskyking ...

  10. fltk_hello world

    int main(int argc, char *argv[]) { #define WINDOW_BG FL_BLACK #define WINDOW_WIDTH 640 #define WINDO ...