#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
using namespace std;
typedef struct{
int x;
int y;
int z;
}t;
t tt[];
bool cmp(t t1,t t2)
{
if(t1.x!=t2.x)
return t1.x<t2.x;
else if(t1.y!=t2.y)
return t1.y<t2.y;
else return t1.z<t2.z;
}
int n;
int dp[];
int main()
{
int c=;
while(~scanf("%d",&n)&&n!=)
{
int cnt=;
for(int i=;i<n;i++)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
{//一组数据有6种情况
tt[cnt].x=a;
tt[cnt].y=b;
tt[cnt++].z=c; tt[cnt].x=a;
tt[cnt].y=c;
tt[cnt++].z=b; tt[cnt].x=b;
tt[cnt].y=a;
tt[cnt++].z=c; tt[cnt].x=b;
tt[cnt].y=c;
tt[cnt++].z=a; tt[cnt].x=c;
tt[cnt].y=a;
tt[cnt++].z=b; tt[cnt].x=c;
tt[cnt].y=b;
tt[cnt++].z=a;
}
}
sort(tt,tt+cnt,cmp); dp[]=tt[].z;
int res=;
for(int i=;i<cnt;i++)
{
int maxx=; for(int j=;j<i;j++)
{
if(tt[i].x>tt[j].x&&tt[i].y>tt[j].y)
{
// printf(" i=%d j=%d\n",i,j); maxx=max(maxx,dp[j]);
} }
dp[i]=tt[i].z+maxx;
res=max(res,dp[i]);
} printf("Case %d: maximum height = %d\n",c++,res);
}
return ;
}

hdu1069 Monkey and Banana LIS的更多相关文章

  1. HDU1069 Monkey and Banana

    HDU1069 Monkey and Banana 题目大意 给定 n 种盒子, 每种盒子无限多个, 需要叠起来, 在上面的盒子的长和宽必须严格小于下面盒子的长和宽, 求最高的高度. 思路 对于每个方 ...

  2. HDU1069 Monkey and Banana —— DP

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit: 2000/1000 MS ...

  3. kuangbin专题十二 HDU1069 Monkey and Banana (dp)

    Monkey and Banana Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  4. HDU1069:Monkey and Banana(DP+贪心)

    Problem Description A group of researchers are designing an experiment to test the IQ of a monkey. T ...

  5. HDU-1069 Monkey and Banana DAG上的动态规划

    题目链接:https://cn.vjudge.net/problem/HDU-1069 题意 给出n种箱子的长宽高 现要搭出最高的箱子塔,使每个箱子的长宽严格小于底下的箱子的长宽,每种箱子数量不限 问 ...

  6. HDU1069 Monkey and Banana(dp)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 题意:给定n种类型的长方体,每个类型长方体无数个,要求长方体叠放在一起,且上面的长方体接触面积要小于 ...

  7. HDU1069 - Monkey and Banana【dp】

    题目大意 给定箱子种类数量n,及对应长宽高,每个箱子数量无限,求其能叠起来的最大高度是多少(上面箱子的长宽严格小于下面箱子) 思路 首先由于每种箱子有无穷个,而不仅可以横着放,还可以竖着放,歪着放.. ...

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

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

  9. ZOJ 1093 Monkey and Banana (LIS)解题报告

    ZOJ  1093   Monkey and Banana  (LIS)解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid= ...

随机推荐

  1. 刷题32. Longest Valid Parentheses

    一.题目说明 题目是32. Longest Valid Parentheses,求最大匹配的括号长度.题目的难度是Hard 二.我的做题方法 简单理解了一下,用栈就可以实现.实际上是我考虑简单了,经过 ...

  2. Aras Innovator Method集成Visual Studio

    首先下载集成安装包: https://github.com/RazorleafLabs/Aras-Integration-to-Visual-Studio 解压文件包,找到Aras-Integrati ...

  3. Spring原理系列一:Spring Bean的生命周期

    一.前言 在日常开发中,spring极大地简化了我们日常的开发工作.spring为我们管理好bean, 我们拿来就用.但是我们不应该只停留在使用层面,深究spring内部的原理,才能在使用时融汇贯通. ...

  4. SQL基础教程(第2版)第4章 数据更新:4-4 事务

    ●事务是需要在同一个处理单元中执行的一系列更新处理的集合. ● 事务处理的终止指令包括COMMIT(提交处理)和ROLLBACK(取消处理)两种. ● DBMS的事务具有原子性(Atomicity). ...

  5. dockerfile---apt-get install vim 时 Unable to locate package vim

    在学习 dockerfile 的时候,发现编写的 Dockerfile 中的 apt-get install 命令无法找到要安装的包,所以记录一下这次发生的错误. 环境:宿主机:windows 10 ...

  6. PAT Advanced 1102 Invert a Binary Tree (25) [树的遍历]

    题目 The following is from Max Howell @twitter: Google: 90% of our engineers use the sofware you wrote ...

  7. MyBatis 查询结果的缓存

    MyBatis的缓存指的是缓存查询结果,当以后使用相同的sql语句.传入相同的参数进行查询时,可直接从mybatis本地缓存中获取查询结果,而不必查询数据库. mybatis的缓存包括一级缓存.二级缓 ...

  8. IaaS SaaS PaaS区别

  9. Vus the Cossack and Strings(Codeforces Round #571 (Div. 2))(大佬的位运算实在是太强了!)

    C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist ...

  10. IntelliJ IDEA 2019.2 LUA环境搭建说明

    1.搭建GCC 添加系统环境变量PATH  为C:\MinGW\bin目录 测试命令进入CMD    gcc -v 2.编译LUA cd到lua/src目录      mingw32-make min ...