hdu 1069 (DP) Monkey and Banana
题目:这里
题意:
Description
Input
Output
Sample Input
2
6 8 10
5 5 5
7
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
5
31 41 59
26 53 58
97 93 23
84 62 64
33 83 27
0
Sample Output
Case 3: maximum height = 28
Case 4: maximum height = 342
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std; struct node{
int h,v,l;
}re[];
int dp[]; int max(int x,int y) {return x>y?x:y;} bool cmp(node a,node b)
{
if (a.l==b.l)
{
if (a.v==b.v)
return a.h>b.h;
return a.v>b.v;
}
return a.l>b.l;
} int main()
{
int n,tem=;
while (~scanf("%d",&n)&&n)
{
int cas=;
for (int i= ; i<=n ; i++)
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
re[++cas].l=x,re[cas].h=y,re[cas].v=z;
re[++cas].l=z,re[cas].h=y,re[cas].v=x;
re[++cas].l=x,re[cas].h=z,re[cas].v=y;
re[++cas].l=y,re[cas].h=z,re[cas].v=x;
re[++cas].l=z,re[cas].h=x,re[cas].v=y;
re[++cas].l=y,re[cas].h=x,re[cas].v=z;
}
sort(re+,re+cas+,cmp);
for (int i= ; i<=cas ; i++)
{
dp[i]=re[i].h;
for (int j= ; j<i ; j++)
{
if (re[i].l<re[j].l&&re[i].v<re[j].v)
dp[i]=max(dp[i],dp[j]+re[i].h);
}
}
int ans=;
for (int i= ; i<=cas ; i++)
ans=max(ans,dp[i]);
printf("Case %d: maximum height = %d\n",++tem,ans);
}
return ;
}
hdu 1069 (DP) Monkey and Banana的更多相关文章
- HDU 1069:Monkey and Banana(DP)
Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 【HDU - 1069】 Monkey and Banana (基础dp)
Monkey and Banana 直接写中文了 Problem Statement 一组研究人员正在设计一项实验,以测试猴子的智商.他们将挂香蕉在建筑物的屋顶,同时,提供一些砖块给这些猴子.如果猴子 ...
- HDU 1069 dp最长递增子序列
B - Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- HDU 1069---背包---Monkey and Banana
HDU 1069 Description A group of researchers are designing an experiment to test the IQ of a monkey. ...
- HDU 1069 Monkey and Banana (DP)
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 1069—— Monkey and Banana——————【dp】
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 1069 Monkey and Banana dp 题解
HDU 1069 Monkey and Banana 纵有疾风起 题目大意 一堆科学家研究猩猩的智商,给他M种长方体,每种N个.然后,将一个香蕉挂在屋顶,让猩猩通过 叠长方体来够到香蕉. 现在给你M种 ...
- HDU 1069 Monkey and Banana(DP 长方体堆放问题)
Monkey and Banana Problem Description A group of researchers are designing an experiment to test the ...
- HDU 1069 Monkey and Banana 基础DP
题目链接:Monkey and Banana 大意:给出n种箱子的长宽高.每种不限个数.可以堆叠.询问可以达到的最高高度是多少. 要求两个箱子堆叠的时候叠加的面.上面的面的两维长度都严格小于下面的. ...
随机推荐
- java SSH框架详解(面试和学习都是最好的收藏资料)
Java—SSH(MVC)1. 谈谈你mvc的理解MVC是Model—View—Controler的简称.即模型—视图—控制器.MVC是一种设计模式,它强制性的把应用程序的输入.处理和输出分开.MVC ...
- java后台调用url无协议
url格式不正确,可能有"www.baidu.com" "这个不能有 // 下载pdf public void downpdf(String URL, String ...
- 对于有了ACM以后的生活
我是大二学生,才接触ACM不到5个星期,因为受到我们班dalao的"引诱",去参加了一次我们学校举行的萌新杯,于是就入坑了,而我又在校外学习一些关于安全的知识,前几天一直纠结要不要 ...
- 通过DIV+span方式模拟进度条的实现方法
上上周用FusionCharts做报表时,有个图是进度条的形式,其实在FusionCharts 3.0之后已经支持了(Linear Gauge),可惜现有系统用的还是1.2.3版本的,重新引入新版本有 ...
- 自动获取MyEcilipse注册名和注册码的方法
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //在MyEc ...
- rabbitMQ+php
RabbitMQ与PHP(一) 项目中使用RabbitMQ作为队列处理用户消息通知,消息由前端PHP代码产生,处理消息使用Python,这就导致代码一致性问题,调整消息定义时需要PHP和Python都 ...
- VUE 入门基础(1)
一,安装 Vue.js 不支持 IE8 及其以下版本,因为 Vue.js 使用了 IE8 不能模拟的 ECMAScript 5 特性. Vue.js 支持所有兼容 ECMAScript 5 的浏览器. ...
- 关于已配置log4j,运行tomcat时显示警告的分析
有时候,我们在JavaEE项目中配置了log4j及其参数信息,但是启动tomcat时,仍会显示如下信息:
- VR发展的最大障碍在于内容?
VR目前基本处于半死不活的状态,国内基本就是一堆的VR“盒子”在浑水摸鱼,就小米有点自知之明,冠以“玩具”的定位.但是说到VR发展的最大问题,居然说是什么内容没有吸引力,真让人无语啊.另外,还有什么价 ...
- 5.2视图中的Order by
创建排序视图的企图本身就是错误的,因为视图表示一个表,而表是不会对行排序的: