hdu1069 Monkey and Banana LIS
#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的更多相关文章
- HDU1069 Monkey and Banana
HDU1069 Monkey and Banana 题目大意 给定 n 种盒子, 每种盒子无限多个, 需要叠起来, 在上面的盒子的长和宽必须严格小于下面盒子的长和宽, 求最高的高度. 思路 对于每个方 ...
- HDU1069 Monkey and Banana —— DP
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit: 2000/1000 MS ...
- kuangbin专题十二 HDU1069 Monkey and Banana (dp)
Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- HDU1069:Monkey and Banana(DP+贪心)
Problem Description A group of researchers are designing an experiment to test the IQ of a monkey. T ...
- HDU-1069 Monkey and Banana DAG上的动态规划
题目链接:https://cn.vjudge.net/problem/HDU-1069 题意 给出n种箱子的长宽高 现要搭出最高的箱子塔,使每个箱子的长宽严格小于底下的箱子的长宽,每种箱子数量不限 问 ...
- HDU1069 Monkey and Banana(dp)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 题意:给定n种类型的长方体,每个类型长方体无数个,要求长方体叠放在一起,且上面的长方体接触面积要小于 ...
- HDU1069 - Monkey and Banana【dp】
题目大意 给定箱子种类数量n,及对应长宽高,每个箱子数量无限,求其能叠起来的最大高度是多少(上面箱子的长宽严格小于下面箱子) 思路 首先由于每种箱子有无穷个,而不仅可以横着放,还可以竖着放,歪着放.. ...
- HDU 1069 Monkey and Banana(二维偏序LIS的应用)
---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- ZOJ 1093 Monkey and Banana (LIS)解题报告
ZOJ 1093 Monkey and Banana (LIS)解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid= ...
随机推荐
- {转} MJPG流媒体在HTML5的呈现方案
最近碰到的需求:监控探头视频呈现到html页面上. 视频源协议:HLS; 视频源格式:Motion JPEG 简称 MJPG; 其中Motion JPEG(M-JPEG或MJPEG,Motion Jo ...
- F5双机冗余配置
转自:https://blog.51cto.com/dynamic/769888本文作者:CTO_LiuJinFeng 1. 配置管理接口-IP 前面文章中没提到如何配置IP,现在开始来配置. 登录- ...
- jupyter notebook 安装配置使用,+目录插件安装
1.安装 pip3 install jupyter 2.配置 2.1. 生成一个 notebook 配置文件 jupyter notebook --generate-config /root/.jup ...
- CAR-T|Single cell plan|Extracellular RNA|
生物医疗大数据 安吉丽娜朱莉发现抑癌基因事件,BRCA突变与乳腺癌关联. 个体化测序商品23 and me 多组学数据研究:eg:太空和地球双胞胎发现生化指标差不多. 研究模式和工业模式相结合. 研究 ...
- 学生信息管理系统java测试报告
package studentinformation; /**姓名 胡海靖 * 学号 20183609 * 班级 信1805-2 */ class ScoreInformation { private ...
- Eureka高可用环境搭建
1.创建govern-center 子工程 包结构:com.dehigher.govern.center 2.pom文件 (1)父工程pom,用于依赖版本管理 <dependencyManage ...
- SeetaFaceEngine系列2:Face Alignment编译和使用
前面一篇写了编译人脸检测部分,现在就介绍下人脸配准部分,SeetaFace的Face Alignment通过人脸的五个关键点来配准人脸,也就是双眼.鼻尖.两个嘴角. 这部分的编译也和上一篇一样,步骤如 ...
- nginx中server块的匹配顺序
客户端发出一个http请求时,nginx收到后会取出header头中的host,与nginx.conf中每个server的server_name进行匹配,以此决定到底由哪一个server块来处理这个请 ...
- JVM内存结构图表展示
1.理解的JVM内存结构 2.对于垃圾回收问题 垃圾的回收只在堆和永久区(方法区)中,因为对于线程而言,私有存储空间如栈.本地方法区.程序计数器等,会随着方法的加载完成而直接释放空间,因此不需要进行 ...
- console.log和alert的区别
alert是同步的,如果不关闭弹出框,js代码就不会继续执行下去,这时候浏览器啥都干不了. console.log不会打断js的执行. 当要输出几十几百条信息的时候还是得用console.log,而且 ...