POJ1050 HDOJ1081 TO THE MAX
来源:互联网 发布:update更新数据代码 编辑:程序博客网 时间:2024/05/22 03:15
求矩阵的最大子矩阵
DP典型例题:
Pku 1050 To The Max http://acm.pku.edu.cn/JudgeOnline/problem?id=1050
Hdu 1081 To The Max http://acm.hdu.edu.cn/showproblem.php?pid=1081
题目的意思很简单,在一个矩阵里面找它的子矩阵,使得子矩阵数值之和到达最大。其实就是最大子段和问题在二维空间上的推广。考察下面题目中的例子:
0 -2 -7 0
9 2 -6 2
-4 1 -4 7
-1 8 0 -2
我们分别用i j表示起始行和终止行,遍历所有的可能:
for(i=1;i<=n;i++)
for(j=i;j<=n;j++) {}
我们考察其中一种情况 i=2 j=4,这样就相当与选中了2 3 4三行,求那几列的组合能获得最大值,由于总是 2 3 4行,所以我们可以将这3行”捆绑”起来,变为求 4(9-4-1),11(8+2+1),-10(-6-4+0),7(7+2-2)的最大子段和,ok,问题成功转化为一维的情况!
- POJ1050 HDOJ1081 TO THE MAX
- hdoj1081 To The Max
- hdoj1081 To The Max (DP)
- POJ1050 To the Max
- POJ1050 To the Max
- POJ1050 To the Max
- poj1050 to the max
- poj1050 To the Max
- poj1050 To the Max
- POJ1050--To the Max
- POJ1050 To the Max
- poj1050 To the Max
- poj1050:to the max
- POJ1050 To the Max
- POJ1050 To the Max
- 【poj1050】 To the Max
- POJ1050-To the Max
- poj1050 to the Max
- Oracle性能调优原则
- Weblogic Server上部署War包
- 一步一步和我走,进入缤纷的嵌入式世界(连载2)
- 在 PHP 中养成 7 个面向对象的好习惯
- User breakpoint called from code at 0x7740240f 已解决
- POJ1050 HDOJ1081 TO THE MAX
- DLL的分类
- file
- SQL语句性能调整原则
- 【转】C#项目中的bin目录和obj目录的区别,以及Debug版本和Release版本的区别
- oracle性能调整的十大要点
- 堆、栈及静态数据区详解
- 使用代码添加主键值
- 东莞互联网专线,光纤专线,SDH,DDN,MPLSVPN。