hdu 1069
//Accepted 264 KB 0 ms
//每种block只有三种方法,且每种放法至多放一次
//规定三条边的顺序后
//把所有的block按x递增排序,x相同则按y递增排序
//然后dp
//dp[i]=max(dp[i],dp[j]+height[i]) i可以放到j上
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
;
struct node
{
int x,y,z;
}p[*imax_n];
*imax_n];
int n;
int max(int a,int b)
{
return a>b?a:b;
}
int min(int a,int b)
{
return a<b?a:b;
}
void Dp()
{
memset(dp,,sizeof(dp));
;i<=*n;i++)
{
;j<i;j++)
if (p[j].x<p[i].x && p[j].y<p[i].y)
dp[i]=max(dp[i],dp[j]+p[i].z);
}
;
;i<=*n;i++)
ans=max(ans,dp[i]);
printf("%d\n",ans);
}
int cmp(struct node p1,struct node p2)
{
;
if (p1.x==p2.x)
{
;
}
;
}
int main()
{
;
while (scanf("%d",&n),n)
{
;i<=n;i++)
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
p[*i-].x=min(x,y);
p[*i-].y=max(x,y);
p[*i-].z=z;
p[*i-].x=min(x,z);
p[*i-].y=max(x,z);
p[*i-].z=y;
p[*i].x=min(y,z);
p[*i].y=max(y,z);
p[*i].z=x;
}
sort(p+,p+*n+,cmp);
printf("Case %d: maximum height = ",++t);
Dp();
}
;
}
hdu 1069的更多相关文章
- HDU 1069 dp最长递增子序列
B - Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- HDU 1069&&HDU 1087 (DP 最长序列之和)
H - Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format: ...
- HDU 1069 Monkey and Banana(二维偏序LIS的应用)
---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- 怒刷DP之 HDU 1069
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 / ZOJ 1093 Monkey and Banana (最长路径)
HDU 1069 Monkey and Banana / ZOJ 1093 Monkey and Banana (最长路径) Description A group of researchers ar ...
- (最大上升子序列)Monkey and Banana -- hdu -- 1069
http://acm.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit:1000MS Memory L ...
- hdu 1069 动规 Monkey and Banana
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u ...
- 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种 ...
随机推荐
- Call requires API level 3 (current min is 1)
结果出现“Call requires API level 3 (current min is 1): 解决方法: 在工程上点击右键 -> Android Tools -> Clear Li ...
- Eclipse远程调试出现“JDWP Transport dt_socket failed to initialize”的解决方案
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...
- 悟透javascript读书笔记
1.undefined,null,0,"" 这四个值转换为逻辑值时是false,其他无论简单类型值,对象或者函数转换过来都是true 2.如图 第一个是“声明了一个变量,给变量赋 ...
- hdu 1710 二叉树的遍历
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1710 大意:给出一个二叉树的前序和中序,求其后序遍历 ps:1.在写链表时,需要写明typedef str ...
- selenium+python笔记1
#!/usr/bin/env python # -*- coding: utf-8 -*- """@desc: 讲讲web项目中常用的方法属性 webdriver 提供了 ...
- js,jquery判断某一节点是否存在
前两天工作时遇到一问题,就是模块A显示时,B是一种样式,模块A删除,B是另一种样式.记录下判断节点存在的方法. 先写下html <!doctype html> <html> & ...
- 初学java之JFrame窗口模式
package project; import javax.swing.*; import java.awt.*; public class test { public static void mai ...
- 118. 119. Pascal's Triangle -- 杨辉三角形
118. Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, ...
- input 中的enabled与disabled属性
<style type="text/css"> *{ padding:; margin:; list-style-type: none; box-sizing:bord ...
- quartz Web项目基础最简单配置
web方面的quartz 配置资料,从网上搜索出来的很难找到完整可用的代码样例.自己上传一个. IDE:Intellij tomcat jdk1.7 quartz 2.1.5 这里下载: http:/ ...