Day9 - F - Monkey and Banana HDU - 1069
Input
Output对于每组测试数据,输出最大高度。格式:Case 第几组数据: maximum height = 最大高度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
const int maxm = ;
struct Node {
int x, y, z;
bool operator<(const Node &a) const {
return x < a.x || (x == a.x && y < a.y);
}
} Nodes[maxm];
int dp[maxm];
int main() {
ios::sync_with_stdio(false), cin.tie();
int n, t1, t2, t3, cnt, kase = ;
while(cin >> n && n) {
cnt = ;
for(int i = ; i <= n; ++i) {
cin >> t1 >> t2 >> t3;
Nodes[++cnt] = Node{t1, t2, t3};Nodes[++cnt] = Node{t2, t3, t1};Nodes[++cnt] = Node{t3, t1, t2};
Nodes[++cnt] = Node{t1, t3, t2};Nodes[++cnt] = Node{t2, t1, t3};Nodes[++cnt] = Node{t3, t2, t1};
}
sort(Nodes+, Nodes++cnt);
memset(dp, , sizeof(dp));
for(int i = ; i <= cnt; ++i) {
dp[i] = Nodes[i].z;
for(int j = ; j < i; ++j)
if(Nodes[i].x > Nodes[j].x && Nodes[i].y > Nodes[j].y)
dp[i] = max(dp[i], dp[j]+Nodes[i].z);
}
int ans = -;
for(int i = ; i <= cnt; ++i) ans = max(ans, dp[i]);
cout << "Case " << ++kase << ": maximum height = " << ans << "\n";
}
return ;
}
Day9 - F - Monkey and Banana HDU - 1069的更多相关文章
- (最大上升子序列)Monkey and Banana -- hdu -- 1069
http://acm.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit:1000MS Memory L ...
- (动态规划 最长有序子序列)Monkey and Banana --HDU --1069
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1069 http://acm.hust.edu.cn/vjudge/contest/view.action ...
- Monkey and Banana HDU - 1069 有点像背包,又像最长上升序列
#include<iostream> #include<algorithm> #include<cstring> #include<vector> us ...
- HDU 1069 Monkey and Banana(二维偏序LIS的应用)
---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- 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 ...
- HDU 1069 Monkey and Banana(转换成LIS,做法很值得学习)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Time Limit: 2000/1000 MS (Java ...
- 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 ...
随机推荐
- 【代码学习】PYHTON 元组
Python的元组与列表类似,不同之处在于元组的元素不能修改.也可进行分片 和 连接操作. 元组使用小括号,列表使用方括号. 一.访问元组 #coding=utf-8 Tuple = ('name', ...
- JavaScript 闭包&基于闭包实现柯里化和bind
闭包: 1 函数内声明了一个函数,并且将这个函数内部的函数返回到全局 2 将这个返回到全局的函数内中的函数存储到全局变量中 3 内部的函数调用了外部函数中的局部变量 闭包简述: 有权访问另一个函数局部 ...
- Nexus-配置vPC 实验一
配置vPC的步骤:1.配置vPC domain2.配置vPC之间的keepalive link3.配置vPC之间的peer link4.配置vPCs5.确认双方配置一致 拓扑及描述:DC1-N7K-5 ...
- OpenThreads库学习
在看STM32资料中看到STM32WB系列“双核无线微控制器配备双核无线微控制器(MCU)配备Bluetooth® 5.OpenThread和ZigBee®3.0连接技术,同时兼备超低功耗性能“不知道 ...
- java窗口程序字符串时间转成时间戳
pom.xml 文件: ?xml version="1.0" encoding="UTF-8"?> <project xmlns="htt ...
- 「JSOI2010」排名
「JSOI2010」排名 传送门 看到先后顺序限制和字典序,很容易想到拓扑排序 + 贪心. 考虑具体做法: 对于第一问: 我们开一个大根堆来代替队列,然后从大到小构造出各个元素的排名. 我们连边 \( ...
- 「JLOI2012」树
「JLOI2012」树 传送门 不得不说这题的数据是真的水... 我们可以想到很明确的一条思路:枚举每一个点向根节点跳,知道路径和不小于 \(s\),恰好等于 \(s\) 就直接加答案. 跳的过程可以 ...
- 操作系统OS,Python - 协程(Coroutine)
留坑 参考: https://en.wikipedia.org/wiki/Coroutine https://zh.wikipedia.org/wiki/%E5%8D%8F%E7%A8%8B http ...
- jqgrid自适应宽度
https://blog.csdn.net/duzhanxiaosa/article/details/78922660
- idna与utf-8编码漏洞
来自Black hat 2019 原理什么是IDN?国际化域名(Internationalized Domain Name,IDN)又名特殊字符域名,是指部分或完全使用特殊文字或字母组成的互联网域名, ...