资 源 简 介
Description
给定一个有N个矩阵的矩阵链A1A2A3...An,矩Ai的维数为pi-1*pi。我们都知道,使用朴素的矩阵乘法去乘两个维数分别为x,y和y,z的矩阵,所需要的乘法次数为x*y*z。矩阵链乘法问题就是如何对矩阵乘积加括号,使得它们的乘法次数达到最少。
Input
输入的第一行为一个正整数N(1<=N<=200)。表示矩阵的个数。
输入的第二行包含N+1个整数,分别表示pi(0<=i<=N),其中每个pi在[1,200]范围内。
Output
输出一个整数表示最少要进行的乘法次数。
-Description Given a matrix N a matrix chain A1A2A3 ... An, moments Ai dimension of pi-1* pi. We all know that the use of simple matrix multiplication to multiply two dimensions, respectively x, y, and y, z matrix, the required number of multiplication x* y* z. Matrix-chain multiplication problem is how to add the product to the matrix in parentheses, allowing them to reach a minimum number of multiplication. Input input first acts of a positive integer N (1 < = N < = 200). Indicated that the number of matrices. Enter the second line contains N+1 integers, respectively, indicated that pi (0 < = i < = N), where each pi in [1,200] range. Output output, said at least one integer numbe