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种箱子的长宽高.每种不限个数.可以堆叠.询问可以达到的最高高度是多少. 要求两个箱子堆叠的时候叠加的面.上面的面的两维长度都严格小于下面的. ...
随机推荐
- 对于旅游业的手机app的分析
对旅游行业的手机app的测试及分析 随着收入水平的提高,旅游已成为人们的惯常需求.或是为了增长见闻,感悟人生:又或者是愉悦感情,消闷解愁:还有的是为了体验生活,追求情调,同时锻炼身体.当然,旅游的目的 ...
- PSP个人(观众界面)
需求:作为一个观众,我希望了解某一场比赛的比分,以便了解赛况.(满意条件:精确到每一局的结果比分) 需求分析:实现查询数据库中每一局的分数并用界面显示. 生成设计文档: 运用三层架构,实现软件的基本功 ...
- neutron floatingip-delete
- 基于谷歌地图的Dijkstra算法水路路径规划
最终效果图如下: 还是图.邻接表,可以模拟出几个对象=>节点.边.路径.三个类分别如下: Node 节点: using System; using System.Collections.Gene ...
- vbox 不识别u盘的问题
usb设备 ->启用usb设备 ->启用usb2.0(ehci)控制器 添加usb筛选器 给筛选器起个名字
- Windows 2008 R2 安装 Windows phone 7 开发环境
安装环境:1.Windows server 2008 R22.Visual Studio 2010 SP1 旗舰版 1.下载 WP7 SDK 离线安装包.(话说要选择与 VS2010 相同语言的版本) ...
- Delphi日期函数、日期加减
Delphi里有现成的函数可以实现日期加减,是在DateUtils单元里的. function IncYear(const AValue: TDateTime; const ANumberOfYear ...
- Django 之Model(ORM)
app01.models.py中写类 python manage.py makemigrations python manage.py migrate python3 manage.py create ...
- H5 JS API 02
1.1 网络状态 我们可以通过window. navigator.onLine来检测,用户当前的网络状况,返回一个布尔值,这个不能实时的通知. addEventListener 进行绑定online从 ...
- js中function参数默认值
--在dreamweaver做网站时,函数定义是在一个*.js文件中,其中定义了一个func,有四个参数,function func(string1,url,flag,icon),然后在另一个asp中 ...