#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; #define INF 100000000 int a[maxn];
int dp[maxn][maxn]; int main(){
Faster;
int n;
cin >> n;
for(int i = ;i <= n;i++){
cin >> a[i];
}
memset(dp, , sizeof(dp));
for(int l = ;l < n;l++){ //长度从2开始
for(int i = ;i+l <= n+;i++){
int j = i+l-;
dp[i][j] = INF;
for(int k = i;k < j;k++){ //枚举中点
dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+][j] + a[i-]*a[k]*a[j]);
}
}
}
cout << dp[][n] << endl;
return ;
}

最新文章

  1. 《徐徐道来话Java》(2):泛型和数组,以及Java是如何实现泛型的
  2. overflow:hidden与margin:0 auto之间的冲突
  3. js get browser vertion (js获取浏览器信息版本)
  4. MongoDB-C#驱动基本操作
  5. 版本控制--github相关
  6. C#对称加密(AES加密)每次生成的密文结果不同思路代码分享
  7. Selenium2+python自动化14-iframe
  8. 面试准备(三) Java 异常类层次结构
  9. Mac Book 上安装Windows 8 / 10 以后安装 Hyper-v 无法正常使用问题---虚拟化已禁止问题
  10. 使用hive访问elasticsearch的数据
  11. 5.Knockout.Js(自定义绑定)
  12. python基础教程第3章——字符串
  13. UTF-8、UTF-16、UTF-32编码的相互转换
  14. Js-Html 前端系列--可伸缩菜单
  15. 封装keyframes插件
  16. 201521123093 java 第十四周学习总结
  17. Serverless无服务应用架构纵横谈
  18. 通过 kms 激活 office 2016
  19. python学习Day13 函数的嵌套定义、global、nonlocal关键字、闭包及闭包的运用场景、装饰器
  20. Cookies 和 Session的区别

热门文章

  1. Android Handle,Looper,Message消息机制
  2. Linux下配置Objective-C编译环境
  3. [HAOI2016]找相同子串
  4. Appium基础——需要知道的
  5. centos 7 / 6 smokeping安装
  6. Android-Universal-Image-Loader使用介绍
  7. AutoIt:AutoIt比我想象的更加强大
  8. 2018值得选用的五个Linux服务器发行版
  9. 洛谷 2668&amp;2540 斗地主——搜索+贪心+dp
  10. bzoj 3489 A simple rmq problem——主席树套线段树