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 ...
随机推荐
- Jmeter在windows系统下的安装
一.工具描述 apache jmeter是100%的java桌面应用程序,它被设计用来加载被测试软件功能特性.度量被测试软件的性能.设计jmeter的初衷是测试web应用, 后来又扩充了其它的功能.j ...
- Card Game for Three
Alice, Bob and Charlie are playing Card Game for Three, as below: At first, each of the three player ...
- windows和ubuntu安装以太坊客户端Mist
Mist钱包下载地址:https://github.com/ethereum/mist/releases Mist = Ethereum Wallet + Web3 浏览器 Dapp:bancor 史 ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 字节交换
大端模式:指数据的高字节保存在内存的低地址中,而数据的低字节保存在内存的高地址中,这样的存储模式有点儿类似于把数据当作字符串顺序处理:地址由小向大增加,而数据从高位往低位放 小端模式:指数据的高字节保 ...
- java实现文字转语音功能(仅Windows)
一.pom.xml引入jar包依赖 <!-- https://mvnrepository.com/artifact/com.jacob/jacob 文字转语音 --> <depend ...
- 转专业后对于C语言补修的一些体会(2)
第三章,有以下几个比较重要的点: 1. 强制类型转换. 强制类型转换是C语言中一个十分重要的工具,在C语言的使用中,有很多需要用到强制类型转换的地方,比如在除法中,如果想要得到正确的浮点结果,一般要确 ...
- office 2016
Excel 2016: F4 : 重复上一步操作. 例子: 如果上一步是合并单元格, 则 再次选中其他几个单元格, F4即再次完成合并. 单元格中插入对角线: 选中单元格, 右键--设置单元格格式- ...
- 杭电 1203 I NEED A OFFER!
I NEED A OFFER! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- 【原】Google浏览器刷新
- linux Shell(待学)
2. Shell 2.1 简介 shell脚本执行方式Shell 是一个用 C 语言编写的程序,通过 Shell 用户可以访问操作系统内核服务.它类似于 DOS 下的 command 和后来的 cmd ...