#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. Linux误删所有内核,恢复内核的解决办法

    前言 我用df -h命令查看磁盘使用情况的时候发现,系统根目录空间已经比较小了,于是我就使用clean命令对系统内核进行清理,一不小心,就把所有的内核删除了,你很有可能也是我的这种经历,非常的崩溃.好 ...

  2. vsCode--设置显示文件和搜索过滤

    文件位置:文件(File)-首选项(Preference)-设置(setting) 打开setting.json文件输入一下内容即可 { "search.exclude": { & ...

  3. CNN:卷积输出分辨率计算

    卷积是CNN非常核心的操作,CNN主要就是通过卷积来实现特征提取的,在卷积操作的计算中会设计到几个概念:步长(strides).补充(padding).卷积核(kernel)等,那卷积的输出分辨率计算 ...

  4. E. Double Elimination (DP)

    题目:传送门 题意:有 2^n 个人进行比赛,对他们编号 1~2^n,起初1和2打,3和4打,5和6打,7和8打...,然后1和2打完胜利的 和 3和4打完胜利的再打一场,1和2打完失败的和3和4打完 ...

  5. 201612-2 工资计算 Java

    思路: 税+税后所得A=税前工资S. 因为工资是整百的数,每次减100来判断.好理解但是超时. import java.util.Scanner; //只有90分,超时了 public class M ...

  6. pywin32获得tkinter的Canvas窗口句柄,并在上面绘图

    上一篇博文获得主窗口句柄使用的是root.frame或者通过子控件调用master.frame方法,但是子控件本身没有frame方法.那么怎么获得子控件的句柄呢?试过了很多办法,想过把Canvas当作 ...

  7. 面试准备 DOM

    基本概念:Dom事件的级别 Dom0 级别 element.onclick=function() {} Dom1  没有制定事件相关的 Dom2 element.addEventListener(&q ...

  8. DVWA-目录遍历-文件包含

    开门见山 · 目录遍历 替换成 2. 文件包含可以使用 绝对路径 也可以 3. 可以使用文件包含来包含一个网址,或者是一个shell 远程文件 空字符绕过字符过滤 %00

  9. 第37章 socket编程 之练习:实现简单的web服务器

    一.参考网址 1.linux C学习之实现简单的web服务器 2.C语言实现简单Web服务器(一)

  10. 洛谷P4071-[SDOI2016]排列计数 题解

    SDOI2016-排列计数 发现很多题解都没有讲清楚这道题为什么要用逆元.递推公式怎么来的. 我,风雨兼程三十载,只为写出一篇好题解. 还是我来造福大家一下吧. 题目大意: 一个长度为 n 且 1~n ...