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. sql还原数据库时候,遇到数据库被占用的解决情况

    最近上班时候,经常要做数据库还原,时常遇到数据被占用的情况, 执行一句sql语句就可以解决, ALTER DATABASE dbname SET OFFLINE WITH ROLLBACK IMMED ...

  2. select into 、 insert into select 、create table as select复制表

    Insert是T-sql中常用语句,Insert INTO table(field1,field2,...)  values(value1,value2,...)这种形式的在应用程序开发中必不可少.但 ...

  3. MYSQL 排行类的相关SQL写法,仅供参考

    SELECT * FROM () )) b

  4. FastSocket学习笔记~制定自已的传输协议

    对于TCP或者UDP来说,它们作于传输层的协议,有着自己的标准,或者叫格式,在我们看TCP格式之前先了解一下计算机的基础知识,字节,它是计算机世界的一个小单位,也是我们可以理会到的,如一个utf-8英 ...

  5. Mysql 的安装与配置

    MySQL的安装 第1步:下载 第2 步:以管理员身份进行安装 第3步:选择安装类型. 第4步:设置MySQL安装目录,及数据库文件目录 第5步:安装结束,开启配置向导 第6步:选择配置类型 第7步: ...

  6. 如何测量一个嵌入式Linux系统的功耗/power dissipation/power wastage/consumption

    参考: 1.Linux Circuit Software To Calculate Power Dissipation

  7. Google Breakpad part 1 : Getting Started With Windows Client

    准备 1.Python 2.Visual Studio 3.svn checkout http://google-breakpad.googlecode.com/svn/trunk/ source c ...

  8. Android 布局 中实现适应屏幕大小及组件滚动

    要实现如图的布局: 这是在eclipse可视化窗口中的截图,但实际运行在Android设备上可能出现的问题有: (1):当编辑图1中的最后一个EditText时,输入法的编辑界面会把底部的Button ...

  9. sqlite3简单使用

    下载SQLite3 地址:http://www.sqlite.org/download.html 下载好的文档是SQlite3.exe,假如放在D盘. cmd D: D:\>SQlite3.ex ...

  10. js中使用使用原型(prototype)定义方法的好处

    经常在前端面试或是和其他同行沟通是,在谈到构造在JS定义构造函数的方法是最好使用原型的方式:将方法定义到构造方法的prototype上,这样的好处是,通过该构造函数生成的实例所拥有的方法都是指向一个函 ...