UVa 437 - The Tower of Babylon(白书)

网友投稿 668 2022-09-04

UVa 437 - The Tower of Babylon(白书)

UVa 437 - The Tower of Babylon(白书)

题目地址:#include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long LL;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;int value[35][3];//第一维表示立方体的序号,第二维表示立方体的长,宽,高int dp1[35][3];int n;void get_arr(int* cf,int a,int b){ int k = 0; for(int i=0; i<3; i++) { if(i != b) cf[k++] = value[a][i]; }}int dp(int x,int y)//用i表示立方体的序号,j表示立方体的高度,来表示一种状态{ int b[2],c[2];//这2个数组开成全局就错了 if(dp1[x][y] > 0) return dp1[x][y]; int ans = 0; get_arr(b,x,y); for(int i=0; i c[0] && b[1] > c[1]) ans = max(ans,dp(i,j)); } } ans += value[x][y]; dp1[x][y] = ans; return ans;}int main(){ int cas = 1; while(scanf("%d",&n) && n) { memset(dp1,0,sizeof(dp1)); for(int i=0; i

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:MySQL由一个双引号引发的误会(mysql 单引号转义)
下一篇:UVa 11400 - Lighting System Design(白书,比较好)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~