//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的更多相关文章

  1. HDU 1069 dp最长递增子序列

    B - Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  2. HDU 1069&&HDU 1087 (DP 最长序列之和)

    H - Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format: ...

  3. HDU 1069 Monkey and Banana(二维偏序LIS的应用)

    ---恢复内容开始--- Monkey and Banana Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  4. 怒刷DP之 HDU 1069

    Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  5. HDU 1069 Monkey and Banana (DP)

    Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  6. 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 ...

  7. (最大上升子序列)Monkey and Banana -- hdu -- 1069

    http://acm.hdu.edu.cn/showproblem.php?pid=1069      Monkey and Banana Time Limit:1000MS     Memory L ...

  8. hdu 1069 动规 Monkey and Banana

     Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u ...

  9. HDU 1069—— Monkey and Banana——————【dp】

    Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  10. HDU 1069 Monkey and Banana dp 题解

    HDU 1069 Monkey and Banana 纵有疾风起 题目大意 一堆科学家研究猩猩的智商,给他M种长方体,每种N个.然后,将一个香蕉挂在屋顶,让猩猩通过 叠长方体来够到香蕉. 现在给你M种 ...

随机推荐

  1. c++ string 与 char 互转 以及base64

    c++ string 与 char 互转 很简单如下 ] = {'A','B','C','D','E'}; printf("%s\n",bts); //char to string ...

  2. 集成代码编辑器ACE的经验

    ACE是最流行的在线代码编辑器之一,在CanTK的集成开发环境GameBuilder里也使用了ACE.ACE的功能非常强大,但是由于使用方法不当,大家反映GameBuilder的代码编辑器不好用.最近 ...

  3. sqlserver计算表使用大小sql

    ) create table #spt_space ( ) null, [rows] int null, ) null, ) null, ) null, ) null ) set nocount on ...

  4. arithmetic

    字典序算法 http://www.cnblogs.com/darklights/p/5285598.html 字典排序(lexicographical order)是一种对于随机变量形成序列的排序方法 ...

  5. js控制手机号码中间用星号代替

    $("#tel").html($("#tel").substring(0,3)+"****"+$("#tel").sub ...

  6. emmet使用笔记及sublime常用快捷键

    2015.10.07补: 格式化JS代码: 安装JSformat插件,选中需要格式化的JS代码,Ctrl+Alt+f 使用笔记看:http://www.w3cplus.com/tools/emmet- ...

  7. 149. Max Points on a Line *HARD* 求点集中在一条直线上的最多点数

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  8. 在CentOS 7 MySQL / MariaDB

    在CentOS7中,MariaDB  替代了MySQL;更多复杂的疑问可以在这里查看 MariaDB versus MySQL – Compatibility Install MySQL / Mari ...

  9. 【转】用PowerDesigner对现有的数据库反向工程建立E-R图

    转自:http://www.cnblogs.com/oceanshare/archive/2010/02/10/1667071.html 由于早期的一个项目在数据库设计建立时没有输出为E-R图,偶在对 ...

  10. js基础练习---图片无缝左右滚动效果(主要以复制删除为主)

    昨天闲来没事 看了下图片效果  发现这个方法j 就自己模仿下 上代码  当中有很多的纰漏 请大神们多多指教一二? <script type="text/javascript" ...