dp  将石块按三个面存入队列  按底面积排序  dp就最大高度  按嵌套矩形最长路做做法

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std;
struct tone
{
int x,y,z;
void t(int a, int b, int c)
{
x = a;
y = b;
z = c;
}
};
bool cmp(tone q, tone p)
{
return q.x*q.y < p.x*p.y;
}
tone tt[100];
int dp[101];
int main()
{
int n;
int ca = 1;
while(scanf("%d",&n) && n)
{
int k = 0;
for(int i = 0; i < n; i++)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
tt[k++].t(a,b,c);
tt[k++].t(b,c,a);
tt[k++].t(c,a,b);
}
sort(tt, tt+k, cmp);
int _max = 0;
for(int i = 0; i < k; i++)
{
dp[i] = tt[i].z;
for(int j = 0; j < i; j++)
{
if((tt[i].x > tt[j].x && tt[i].y > tt[j].y) || (tt[i].x > tt[j].y && tt[i].y > tt[j].x))
{
dp[i] = max(dp[i], dp[j]+tt[i].z);
}
}
_max = max(_max, dp[i]);
}
printf("Case %d: maximum height = %d\n", ca++, _max);
}
return 0;
}

uva 437 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. UVA 437 十九 The Tower of Babylon

    The Tower of Babylon Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Subm ...

  5. 怒刷DP之 HDU 1069

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

  6. HDU 1069 Monkey and Banana (DP)

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

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

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

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

  9. hdu 1069 动规 Monkey and Banana

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

随机推荐

  1. Xcode Product -> Archive disabled

    You've changed your scheme destination to a simulator instead of "iOS Device". That's why ...

  2. C# 中控件 WebBrowser 对 frameset/ iframe 操作和内容获取

    1.获取frame的document HtmlDocument htmlDoc = webBrowser1.Document;  htmlDoc = webBrowser1.Document.Wind ...

  3. 第五篇、微信小程序-swiper组件

    常用属性: 效果图: swiper.wxml添加代码: <swiper indicator-dots="{{indicatorDots}}" autoplay="{ ...

  4. Call C# code from C++

    Reference: https://support.microsoft.com/en-us/kb/828736 Calling C# .NET methods from unmanaged C/C+ ...

  5. ubuntu 阿里云安全配置

    1. 添加新用户, 加入 root 组, 赋予 sudo 权限 2. 禁用 root 3.

  6. java学习笔记_MIDI_GUI

    import javax.sound.midi.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; class M ...

  7. ssh 登陆指定 验证文件

    当前用户jim ssh-keygen -t rsa 生成密钥 把pub结尾的公用密钥数据追加到192.168.1.3上的 /home/tom/.ssh/authKeys(文件名可能不一样) ssh - ...

  8. 关于font awesome或Glyphicons字体图标不能正确显示的问题

    此处讨论的是关于本地字体的安装和引进 实际操作经验中,某些网站模板设置的CSS, FONTS目录较深,如果按默认的路径设置,字体图标死活都不会显示. 解决办法是将FONTS目录,安装在网站根目录下 C ...

  9. php微信支付(仅Jsapi支付)详细步骤.----仅适合第一次做微信开发的程序员

    本人最近做了微信支付开发,是第一次接触.其中走了很多弯路,遇到的问题也很多.为了让和我一样的新人不再遇到类似的问题,我把我的开发步骤和问题写出来,以供参考. 开发时间是2016/8/2,所以微信支付的 ...

  10. 深入理解php的MySQL连接类

    php的MySQL连接类.  后面几个show_databases和show_tables....等方法都用了一堆echo,好像一直不喜欢在类的方法里直接用输出语句,不过这也只是列举数据库和表名,构造 ...