ACM: 动态规划题 poj 2241
来源:互联网 发布:mac下面的图标怎么换掉 编辑:程序博客网 时间:2024/05/22 01:37
The babylonians had n types of blocks, and an unlimited supply ofblocks of each type. Each type-i block was a rectangular solid withlinear dimensions (xi, yi, zi). A block could be reoriented so thatany two of its three dimensions determined the dimensions of thebase and the other dimension was the height.
They wanted to construct the tallest tower possible by stackingblocks. The problem was that, in building a tower, one block couldonly be placed on top of another block as long as the two basedimensions of the upper block were both strictly smaller than thecorresponding base dimensions of the lower block. This meant, forexample, that blocks oriented to have equal-sized bases couldn't bestacked.
Your job is to write a program that determines the height of thetallest tower the babylonians can build with a given set ofblocks.
Input
representing the number of different blocks in the following dataset. The maximum value for n is 30.
Each of the next n lines contains three integers representing thevalues xi, yi and zi.
Input is terminated by a value of zero (0) for n.
Output
Sample Input
1
10 20 30
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 1: maximum height = 40
Case 2: maximum height = 21
Case 3: maximum height = 28
Case 4: maximum height = 342
题意: 给出每种积木的长宽高, 并且每块积木的个数不定, 现在要你计算出积木堆起来最大高度,
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 31
const int INF = (1<<29);
int n;
int g[MAX*3][3];
int dp[MAX*3];
int num;
inline int max(int a,int b)
{
}
void add(int a,int b,int c)
{
}
int DP(int i)
{
}
int main()
{
//
}
- ACM: 动态规划题 poj 2241
- ACM: 简单动态规划题 poj 2955
- ACM: 动态规划题 poj 1054
- ACM: 动态规划题 poj 2948
- ACM: 动态规划题 poj 1925
- ACM: 动态规划题 poj 3034
- ACM: 动态规划题 poj 2411
- ACM: 动态规划题 poj 1947
- ACM: 动态规划题 poj 2486
- ACM: 动态规划题 poj 3140
- ACM: 动态规划题 poj 3659
- ACM: 动态规划题 poj 2923
- ACM: dp动态规划题(难) poj 3267 …
- ACM: dp题(动态规划) poj 2151 (d…
- ACM: 树状DP 动态规划题 poj 1463 …
- ACM: 动态规划题 poj 2057 树状DP
- ACM:动态规划题 poj 1015
- ACM: 动态规划题 poj&nb…
- ACM: 贪心法 poj 1700
- ACM: 博弈题 poj 1067
- ACM: 动态规划题+剪枝 toj 3904
- ACM: 动态规划题 toj 1072
- ACM: 最大连续和O(N) 动态规划 toj…
- ACM: 动态规划题 poj 2241
- ACM: 动态规划题 toj1328
- ACM: 背包问题 动态规划题 toj 133…
- ACM: 动态规划体 toj 1408
- ACM: 训练题 动态规划题 (蛮有意思…
- ACM: 简单 动态规划题 poj 3036
- ACM: 动态规划题 toj 1508
- ACM: 简单 动态规划题 toj 1509 (…
- ACM: 图论题 poj 1135