-
zoj1094
zoj094
Matrix multiplication problem is a typical example of dynamical programming.
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. However, the number of elementary multiplications needed strongly depends on the evaluation order you choose.
For example, let A be a 50*10 matrix, B a 10*20 matrix and C a 20*5 matrix.
There are two different strategies to compute A*B*C, namely (A*B)*C and A*(B*C).
The first one takes 15000 elementary multiplications, but the second one only 3500.
Your job is to write a program that determines the number of elementary multiplications needed for a given evaluation strategy.
(Matrix multiplication problem is a typical example of dynamical programming.
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. However, the number of elementary multiplications needed strongly depends on the evaluation order you choose.
For example, let A be a 50*10 matrix, B a 10*20 matrix and C a 20*5 matrix.
There are two different strategies to compute A*B*C, namely (A*B)*C and A*(B*C).
The first one takes 15000 elementary multiplications, but the second one only 3500.
Your job is to write a program that determines the number of elementary multiplications needed for a given evaluation strategy.
)
- 2012-06-10 10:38:53下载
- 积分:1
-
从事编程的时间已经有几年了,从在学校的小打小闹的编程到现在的在专
门的从事电脑编程的软件公司工作已经有几年了,感慨万千,这中间有过许许多多的...
从事编程的时间已经有几年了,从在学校的小打小闹的编程到现在的在专
门的从事电脑编程的软件公司工作已经有几年了,感慨万千,这中间有过许许多多的
酸甜苦辣,以及有着许许多多的不眠之夜,在此我首先感谢我的朋友们对我的支持,
谢谢你们,同时还要谢谢那些老前辈留下的那些技巧,在我每次面对问题要解决的时
候,是你们辛苦地摸索出来的东西让我豁然开朗,问题迎刃而解.
写这些东西的缘由说来也颇为简单,因为自己觉的有很多的技巧应该与大
家分享,同时也希望我平常所收集的以及我的个人心得能帮助所有编程序的人员 ,
能将我写的这个东西成为你编程的宝典,由于是我第一次做这样的东西,难免会有这
样或是那样的不足之处,还请广大朋友指正. 由于技巧不断的更新 , 所以这个东西也
要不断的更新,我第一次首先尝试制作有关Delphi的技巧,由于我现在用的是她,所以
先写Delphi的技巧,其他的诸如VB、VC的技巧等我整理以后再进行制作,还希望广
大的网友多多支持。-Programming time has been engaged for several years, chipping away from the school of programming to the current in the tertiary
The door in computer programming, software company, has been for several years, and filled with emotion, which had many of the middle
Ups and downs, as well as with many sleepless nights, and I begin to thank my friends for their support,
Thank you, thank you to those old-timers while also leaving those skills in every time I face the problem to be solved when the
Hou, yes you have worked hard to
- 2022-10-06 18:55:03下载
- 积分:1
-
FEC
explain the coding and decoding of FEC
- 2010-09-16 01:10:14下载
- 积分:1
-
图形学
图形学DDA算法(graphics algorithm)
- 2004-11-19 08:39:02下载
- 积分:1
-
该代码用于将dicom格式的医学图像立体化
资源描述dicom作为医学图像的标准格式,包含了临床诊断中病人病例指标的各项关键信息,本代码的意义在于将一副dicom图像可视化并将其三维可视化,赋予较立体的感观结果。
- 2023-03-10 07:15:03下载
- 积分:1
-
stc_led
STC8A8K64S4A12,LED等点亮程序,小灯循环亮灭(STC8A, LED and other lighting procedures)
- 2019-03-20 07:57:52下载
- 积分:1
-
IPv4
在IPv4分组收发实验的基础上,增加了IPv4分组的转发功能,从而实现路由器中的IPv4协议,初步实现了路由查找算法。(IPv4 packet in the send and receive on the basis of experiments, an increase of IPv4 packet forwarding in order to achieve the IPv4 protocol router, the initial realization of the routing search algorithm.)
- 2011-06-05 11:29:32下载
- 积分:1
-
ceju
说明: 柱子P1、P2的位置是可以随意摆放的,机器人R沿黑线方向行走。利用6号和9号声纳来测距离(这两个声纳的测量角度比较大,可以很好号的实现设计要求),6号声纳测机器人与P1的距离d1,9号测机器人与P2的距离d2。当机器人行走到某处时,两个声纳分别测到的距离差d1-d2小于20mm,并且d1、d2都小于600mm时,则判断为此时机器人行走到了P1与P2的中间,机器人转90°,沿两柱子的中心线继续向前走。(Columns P1, P2 position can be arbitrarily placed, the direction of the robot R to walk along the black line. 6 and 9, using sonar to measure the distance (the measurement point of view the two sonar relatively large, a good number can meet the design requirements), 6 sonar distance measuring robot and P1 d1, 9 号 testing machine Man and P2 distance d2. When the robot to walk somewhere, two sonar distances were measured to the difference d1-d2 is less than 20mm, and d1, d2 is less than 600mm, then determine the robot to walk at this time to the middle of P1 and P2 the robot turn 90 °, along the center line of the two pillars to continue to move forward.)
- 2010-04-14 20:21:51下载
- 积分:1
-
transmitter-module-
发射端程序 单片机STC15L204EA 发射模块NRF24L01(NRF24L01 transmitter module STC15L204EA)
- 2015-11-27 14:17:11下载
- 积分:1
-
QPR_Control
比例-谐振控制器,抑制谐波,有效的将谐波滤除(The proportional resonant controller suppresses harmonics and effectively filters harmonics)
- 2017-06-21 11:36:07下载
- 积分:1