hdu 1069 Monkey and Banana//DP
来源:互联网 发布:linux 压缩包 编辑:程序博客网 时间:2024/05/29 23:43
#include"iostream"
#include"stdio.h"
#include"algorithm"
using namespace std;
#define MAXN 32
struct NODE
{
int l,w,h,s;
}node[MAXN*3];
int dp[MAXN*3];
bool cmp(NODE a,NODE b)
{
return a.l*a.w>b.l*b.w;
}
bool check (int i,int j)
{
if(node[i].l
return true;
if(node[i].l
return true;
return false;
}
int main()
{
int n,count=1,i,j;
while(scanf("%d",&n)&& n!=0)
{
int x,y,z;
for(i=0;i
{
scanf("%d%d%d",&x,&y,&z);
node[3*i].l = x; node[3*i].w = y; node[3*i].h = z;
node[3*i+1].l = y; node[3*i+1].w = z; node[3*i+1].h = x;
node[3*i+2].l = x; node[3*i+2].w = z; node[3*i+2].h = y;
}
sort(node,node+3*n,cmp);
dp[0]=node[0].h;
for(i=1;i<3*n;i++)
{
int max=0;
for(j=0;j
if(max
max=dp[j];
dp[i]=max+node[i].h;//key point
int ans=dp[0];
for(i=1;i<3*n;i++)
{
if(ans
ans=dp[i];
}
printf("Case %d: maximum height = %d\n",count++,ans);
}
}
- hdu 1069 Monkey and Banana//DP
- hdu 1069 Monkey and Banana //DP
- HDU 2577 How to Type (DP)
- HDU 2859 Phalanx(dp吧~ ~ ~)
- HDU 1028 Ignatius and the Princ…
- HDU 1242 Rescue
-  
-
- hdu 1003 Max Sum//DP
- hdu 3351 //大括号配对儿 DP
- hdu 2577 How to Type //简单DP
- hdu 1024 Max Sum Plus Plus//DP
- hdu 1858 Max Partial Value I(DP…
- HDU 1029 Ignatius and the Prince…
- HDU 1078 FatMouse and Cheese(肥…
- hdu 1028 Ignatius and the Prince…
- POj 1159 Palindrome (dp)
- dp 3267 The Cow Lexicon
- hdu 1002 大数相加
- hdu 1040 As Easy As A+B
- hdu 1024 Max Sum Plus Plus//DP
- hdu 1003 Max Sum//DP
- hdu 1002 大数相加笨办法_开数组
- hdu 1069 Monkey and Banana//DP
- hdu 3351 //大括号配对儿 DP
- hdu 2039 三角形 /…
- *hdu 2412 Party at Hali-Bula
- hdu 2040 亲合数
- hdu 1064 Financial&nbs…
- hdu 1303 doubles …
- poj 2739 sum of&n…
- hdu 1065 I Think&…