#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200
using namespace std;
struct
node
{

int
x,y,z;
};

int
cmp(node a,node b)
{

if
(a.x==b.x) return a.y<b.y;
return
a.x<b.x;
}

int
mymax(int x,int y)
{

if
(x>y) return x;
return
y;
}

int
main()
{

int
n;
int
Case=;
while
(cin>>n&&n)
{

node fuck[maxn];
int
dp[maxn];
memset(dp,,sizeof(dp));
int
ret=;
while
(n--)
{

int
x,y,z;
cin>>x>>y>>z;
fuck[ret].x=x,fuck[ret].y=y,fuck[ret++].z=z;
fuck[ret].x=x,fuck[ret].y=z,fuck[ret++].z=y;
fuck[ret].x=y,fuck[ret].y=x,fuck[ret++].z=z;
fuck[ret].x=y,fuck[ret].y=z,fuck[ret++].z=x;
fuck[ret].x=z,fuck[ret].y=x,fuck[ret++].z=y;
fuck[ret].x=z,fuck[ret].y=y,fuck[ret++].z=x;
}

sort(fuck,fuck+ret,cmp);
dp[]=fuck[].z;
for
(int i=;i<ret;i++)
{

dp[i]=fuck[i].z;
for
(int j=;j<i;j++)
{

if
(fuck[j].x<fuck[i].x&&fuck[j].y<fuck[i].y)
{

dp[i]=mymax(dp[i],dp[j]+fuck[i].z);
}
}
}

//这里的dp只是算出了每个i对应的值 并没有算出最大的
int zz=dp[];
for
(int i=;i<ret;i++) if(zz<dp[i]) zz=dp[i];
printf("Case %d: maximum height = %d\n",++Case,zz);
}

return
;
}

hdu 1068 最大子序列和变形,,,的更多相关文章

  1. hdu5282 最长公共子序列的变形

    pid=5282">http://acm.hdu.edu.cn/showproblem.php?pid=5282 Problem Description Xuejiejie loves ...

  2. HDU 1068 Girls and Boys(最大独立集合 = 顶点数 - 最大匹配数)

    HDU 1068 :题目链接 题意:一些男孩和女孩,给出一些人物关系,然后问能找到最多有多少个人都互不认识. 转换一下:就是大家都不认识的人,即最大独立集合 #include <iostream ...

  3. DP专辑之最长公共子序列及其变形

    vijos1111(裸的最长公共子序列) 链接:www.vijos.org/p/1111 题解:好久没有写最长公共子序列了,这题就当是复习了.求出最长公共子序列,然后用两个单词的总长度减去最长公共子序 ...

  4. HDU 1080 Human Gene Functions - 最长公共子序列(变形)

    传送门 题目大意: 将两个字符串对齐(只包含ACGT,可以用'-'占位),按照对齐分数表(参见题目)来计算最后的分数之和,输出最大的和. 例如:AGTGATG 和 GTTAG ,对齐后就是(为了表达对 ...

  5. HDU 5489 Removed Interval (LIS变形)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5489 给你n个数,要删去其中连续的L个,问你删去之后的LIS最大是多少? 我们先预处理出以i下标为开头 ...

  6. HDU 5773 The All-purpose Zero (变形LIS)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5773 0可以改变成任何数,问你严格递增的子序列最长是多少. 猜测0一定在最长上升子序列中用到,比如2 ...

  7. HDU 1068 Girls and Boys (二分图最大独立集)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1068 有n个同学,格式ni:(m) n1 n2 n3表示同学ni有缘与n1,n2,n3成为情侣,求集合 ...

  8. [HDU] 1068 Girls and Boys(二分图最大匹配)

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1068 本题求二分图最大独立点集.因为最大独立点集=顶点数-最大匹配数.所以转化为求最大匹配.因为没有给 ...

  9. hdu 1068 Girls and Boys 最大独立点集 二分匹配

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1068 思路: 求一集合满足,两两之间没有恋爱关系 思路: 最大独立点集=顶点数-最大匹配数 这里给出的 ...

随机推荐

  1. java并发编程--第一章并发编程的挑战

    一.java并发编程的挑战 并发编程需要注意的问题: 并发编程的目的是让程序运行的更快,然而并不是启动更多的线程就能让程序最大限度的并发执行.若希望通过多线程并发让程序执行的更快,会受到如下问题的挑战 ...

  2. Redis监控之redis-stat安装与详解

    一.安装环境 安装编译环境.ruby运行环境.git代码 yum install gcc-c++ yum -y install ruby-devel yum install ruby yum inst ...

  3. C 习题

    1,日本某地发生命案,警察通过排查确定4个人中一个人为凶手,一下为4个人的供词, A:不是我 B:是C C:是D D:C说谎 解决方式: #include<stdio.h> int mai ...

  4. CImage中m_hBitmap!=0弹框报错

    见图.查资料说是图片打印出现问题. 我的代码流程主要是:读图到CImage中,然后转移到数组中,将原对象销毁,对图像内容处理后,保存. 原来没问题,在加了参数循环后报错. 考虑到是循环中一些因素初始化 ...

  5. C# DumpBin使用 查看反射C++ dll 动态链接库中的函数

    DumpBin是Microsoft提供的一个用于查看.exe..dll文件信息的工具,其位于: C:\Program Files (x86)\Microsoft Visual Studio 10.0\ ...

  6. set serveroutput on

    使用set serveroutput on 命令设置环境变量serveroutput为打开状态,从而使得pl/sql程序能够在SQL*plus中输出结果 使用函数dbms_output.put_lin ...

  7. C++ STL partial_sort_copy greater

    #include <iostream>#include <deque>#include <algorithm>#include <vector>#inc ...

  8. shared pointer

    #include <string>#include <fstream>#include <memory>#include <cstdio> class ...

  9. MySQL连接错误:Can't connect to MySQL server on'localhost' (10055)

    在Windows服务器上确认服务器和mysql都是正常运行,但就是连接不上.搜了一下别人的解决方案, 参考这篇https://blog.csdn.net/langren697/article/deta ...

  10. 极客时间-左耳听风-程序员攻略-异步I/O模型和Lock-Free编程

    异步 I/O 模型 异步 I/O 模型其中的设计模式或是解决方法可以借鉴到分布式架构上来. 史蒂文斯(Stevens)在<UNIX 网络编程>一书 6.2 I/O Models 中介绍了五 ...