UVA - 10688 The Poor Giant
来源:互联网 发布:matlab编程例题 编辑:程序博客网 时间:2024/05/21 14:09
题意:区间DP,没做出来,参考:点击打开链接
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 510;const int INF = 0x3f3f3f3f;int n,k,val[MAXN];int dp[MAXN][MAXN];int main(){ int t,cas=1; scanf("%d",&t); while (t--){ scanf("%d%d",&n,&k); for (int i = 1; i <= n; i++) val[i] = k + i; memset(dp,0,sizeof(dp)); for (int d = 2; d <= n; d++) for (int l = 1; l + d -1 <= n; l++){ int r = l + d - 1; int &ans = dp[l][r] = INF; for (int mid = l; mid <= r; mid++) ans = min(ans,dp[l][mid-1]+dp[mid+1][r]+d*val[mid]); } printf("Case %d: %d\n",cas++,dp[1][n]); } return 0;}
- UVA - 10688 The Poor Giant
- Uva 10688 The Poor Giant (区间DP)
- UVA 10688 The Poor Giant (区间DP)
- UVA - 10688 —— The Poor Giant
- uva 10688 - The Poor Giant(区间dp)
- uva 10688 - The Poor Giant(记忆化搜索)
- UVA 10688 - The Poor Giant(区间DP)
- UVa 10688 The Poor Giant(区间DP)
- uva 10688 - The Poor Giant(区间DP,较难,题目难懂,状态转移难。。。)
- The Selfish Giant
- How the Poor Die
- poor
- The poor people should live a poor life in a poor way.
- KitKat - The Lazy/Poor Man's Rootkit
- nbu 2414 Please help the poor donkey!
- nbu 2414 Please help the poor donkey!
- KitKat - The Lazy/Poor Man's Rootkit
- Linus Benedict Torvalds-a giant to push the world forward
- (9)求旋转数组中的最小数值
- linux下安装flash_flayer+复制文件
- 常用网络指令
- JavaSE_网络编程_TCP_练习4_与浏览器和服务端交互
- MDCC2013会议笔记
- UVA - 10688 The Poor Giant
- c/c++ 学习-open 函数
- 数据结构(hash)哈希算法 及各算法比较
- 怎样编译ffmpeg生成.a文件,让其支持不同的架构
- js之浅谈
- 黑马程序员_毕向东_Java基础视频教程学习笔记(五)
- SMA、SMB、SMC封装的二极管尺寸区分
- Http协议详解
- 认识ActiveX控件