#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 ;
}

E - Multiplication Puzzle的更多相关文章

  1. poj 1651 Multiplication Puzzle (区间dp)

    题目链接:http://poj.org/problem?id=1651 Description The multiplication puzzle is played with a row of ca ...

  2. POJ1651:Multiplication Puzzle(区间DP)

    Description The multiplication puzzle is played with a row of cards, each containing a single positi ...

  3. ZOJ 1602 Multiplication Puzzle(区间DP)题解

    题意:n个数字的串,每取出一个数字的代价为该数字和左右的乘积(1.n不能取),问最小代价 思路:dp[i][j]表示把i~j取到只剩 i.j 的最小代价. 代码: #include<set> ...

  4. POJ 1651 Multiplication Puzzle (区间DP)

    Description The multiplication puzzle is played with a row of cards, each containing a single positi ...

  5. Poj 1651 Multiplication Puzzle(区间dp)

    Multiplication Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10010   Accepted: ...

  6. POJ 1651 Multiplication Puzzle(类似矩阵连乘 区间dp)

    传送门:http://poj.org/problem?id=1651 Multiplication Puzzle Time Limit: 1000MS   Memory Limit: 65536K T ...

  7. Multiplication Puzzle ZOJ - 1602

    Multiplication Puzzle ZOJ - 1602 传送门 The multiplication puzzle is played with a row of cards, each c ...

  8. POJ1651 Multiplication Puzzle —— DP 最优矩阵链乘 区间DP

    题目链接:https://vjudge.net/problem/POJ-1651 Multiplication Puzzle Time Limit: 1000MS   Memory Limit: 65 ...

  9. xtu read problem training 4 B - Multiplication Puzzle

    Multiplication Puzzle Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on PKU. O ...

  10. 题解【POJ1651】Multiplication Puzzle

    Description The multiplication puzzle is played with a row of cards, each containing a single positi ...

随机推荐

  1. Oracle 11gR2 使用RMAN Duplicate复制数据库

    Oracle 11gR2 使用RMAN Duplicate复制数据库     前言:     上周刚做完一个项目,用户要求RAC的数据库可以自己主动备份到另外一个单节点上,单节点可以正常拿起来就能用. ...

  2. selenium使用笔记(一)——selenium你该知道的

    有时候在交流群里经常会看到这样的问题,selenium能进行性能测试吗?selenium1和selenium2有什么区别等等问题,在这里谈一下自己学习和工作以后对selenium的认识.我所记录的东西 ...

  3. 安装python解释器

    Python目前已支持所有主流操作系统,在Linux,Unix,Mac系统上自带Python环境,在Windows系统上需要安装一下,超简单 打开官网 https://www.python.org/d ...

  4. html5--3.8 input元素(7)

    html5--3.8 input元素(7) 学习要点 input元素及其属性 input元素 用来设置表单中的内容项,比如输入内容的文本框,按钮等 不仅可以布置在表单中,也可以在表单之外的元素使用 i ...

  5. android:textAppearance

    Android之系统自带的文字外观设置及实际显示效果图 android:textAppearancexml布局里面设置文字的外观: 如“android:textAppearance=“?android ...

  6. rkhunter和chkrootkit

    今天继续检查我的Linux,所以下来rkhunter和chkrootkit一个一个来,下面只记录命令,少些说明不截图了. 1.rkhunter #cd /temp #wget http://downl ...

  7. CodeForces - 762E:Radio stations (CDQ分治||排序二分)

    In the lattice points of the coordinate line there are n radio stations, the i-th of which is descri ...

  8. BZOJ_5415_[Noi2018]归程_kruscal重构树+倍增+最短路

    BZOJ_5415_[Noi2018]归程_kruscal重构树+倍增 Description www.lydsy.com/JudgeOnline/upload/noi2018day1.pdf 好久不 ...

  9. AutoIt:应用WMI接口,打印远程机器安装的所有应用程序

    Dim $computer ="computer name" Dim $Remoteuser ="Login account" Dim $Remotepass ...

  10. 魔法少女-dp

    魔法少女 Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %I64d & %I64u 前些时间虚渊玄的巨献小圆着实火 ...