poj 1651
来源:互联网 发布:淘宝的a3狗粮怎么样 编辑:程序博客网 时间:2024/06/05 09:45
#include <stdio.h>#include <string>#include <algorithm>using namespace std;const int maxn = 106;const int inf = 0x3f3f3f3f;int dp[maxn][maxn] = { 0 }, n;int a[maxn];int main(){while (scanf("%d", &n) != EOF){memset(dp, 0, sizeof(dp));for (int i = 0; i < n; i++)scanf("%d", &a[i]);for (int len = 2; len < n; len++){for (int i = 0; i + len < n; i++){int k = i + len;for (int j = i + 1; j < i + len; j++){if (dp[i][k] == 0)dp[i][k] = dp[i][j] + dp[j][k] + a[j] * a[i] * a[k];dp[i][k] = min(dp[i][k],a[j] * a[i] * a[k] + dp[i][j] + dp[j][i + len]);}}}printf("%d\n", dp[0][n - 1]);}return 0;}
0 0
- poj 1651
- poj 1651
- poj 1651
- POJ 1651
- POJ 1651
- poj 1651
- POJ 1651
- poj 1651
- poj 1651
- POJ 1651
- POJ 1651
- POJ 1651 Multiplication Puzzle
- POJ 1651动态规划
- poj 1651 Multiplication Puzzle
- POJ 1651 Multiplication Puzzle
- poj 1651 DP
- poj 1651 Multiplication Puzzle
- poj acm 1651
- 技术剖析Potato提权原理
- DBCP数据库连接池的配置
- Trianglur Design--找规律
- 揭开异常工作的恶意文档的秘密
- 分页核心SQL
- poj 1651
- cocos2dx 定时器
- 二叉树存储 最小堆
- Blog Four years
- Android 之绑定服务
- day11续—状态管理
- Android下的Button按钮点击事件
- 在Internet上快速检索信息
- 求最大字段和问题(常规法,分治法,动态规划法)