本文共 1553 字,大约阅读时间需要 5 分钟。
给你n砖,有三个长宽高。每一个无限制的访问。叠加在一个条件的长度和宽度必须严格格长度和宽度大于下面的一个,叠加求最大高度。
思维:
每块砖终于放置在根据本方法可以把六种,然后,对于长度和宽度排序。这是LIS的变化的问题
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ll long long#define LL __int64#define eps 1e-8#define inf 0xfffffff//const LL INF = 1LL<<61;using namespace std;//vector > G;//typedef pair P;//vector > ::iterator iter;////map mp;//map ::iterator p;int box[500][3];int dp[1000];int cnt;typedef struct Node { int x,y,z;};Node node[500];void init() { memset(box,0,sizeof(box)); memset(dp,0,sizeof(dp)); cnt = 0;}/*void cal(int x,int y,int z) {box[cnt][0] = x,box[cnt][1] = y,box[cnt++][2] = z;box[cnt][0] = y,box[cnt][1] = x,box[cnt++][2] = z;box[cnt][0] = y,box[cnt][1] = z,box[cnt++][2] = x;box[cnt][0] = z,box[cnt][1] = y,box[cnt++][2] = x;box[cnt][0] = x,box[cnt][1] = z,box[cnt++][2] = y;box[cnt][0] = z,box[cnt][1] = x,box[cnt++][2] = y;}*/void cal(int x,int y,int z) { node[cnt].x = x,node[cnt].y = y,node[cnt++].z = z; node[cnt].x = y,node[cnt].y = x,node[cnt++].z = z; node[cnt].x = y,node[cnt].y = z,node[cnt++].z = x; node[cnt].x = z,node[cnt].y = y,node[cnt++].z = x; node[cnt].x = x,node[cnt].y = z,node[cnt++].z = y; node[cnt].x = z,node[cnt].y = x,node[cnt++].z = y;}bool cmp(Node x,Node y) { if(x.x == y.x) { if(x.y == y.y)return x.z < y.z; return x.y < y.y; } return x.x < y.x;}int main() { int n; int Case = 0; while(scanf("%d",&n),n) { init(); for(int i=0;i
转载地址:http://airxl.baihongyu.com/