POJ 1050 To the Max ——二维最大子段和
来源:互联网 发布:fi是什么软件 编辑:程序博客网 时间:2024/06/04 20:04
题目链接 点击打开链接
#include<iostream>using namespace std;int a[105][105],dp[105],Max=-100000;int solve(int n){ int i,j,k,t; for(i=0; i<n; i++) { for(j=i; j<n; j++) { for(k=0; k<n; k++) { dp[k]=0; for(t=i; t<=j; t++) { dp[k]+=a[t][k]; } } int sum=0; for(k=0; k<n; k++) { sum+=dp[k]; if(sum<0) sum=0; if(Max<sum) { Max=sum; } } } } return Max;}int main(){ int i,j,n; cin>>n; for(i=0; i<n; i++) { for(j=0; j<n; j++) { cin>>a[i][j]; } } cout<<solve(n)<<endl; return 0;}
0 0
- POJ-1050 To the Max 二维最大子段和
- POJ 1050 To the Max ——二维最大子段和
- poj 1050 To the Max(动态规划处理二维最大子段和)
- POJ-1050-To the Max-二维最大子序列和
- POJ 1050 To the Max(dp 最大子矩阵和/最大子段和问题)
- POJ 1050 To the Max && POJ 2479Maximum sum(DP最大连续子段和)
- POJ 1050 To the Max(动态规划-最大子段和)
- poj 1050To the Max(最大子矩阵和 DP 二维)
- 连续子数组的最大和问题(一维和二维)To the Max (POJ 1050)
- HDU-1081-To The Max(二维最大子段和)
- POJ 1050 To the Max (动态规划——求最大子矩阵和)
- poj 1050 To the Max 最大子矩阵和
- poj 1050 To the Max(最大子矩阵和)
- poj 1050 To the Max(最大子矩阵和)
- POJ 1050-To the Max(最大子矩阵和)
- POJ 1050 To the Max (最大子矩阵和)
- [POJ 1050] To the Max DP+最大子矩阵和
- 【最大子矩阵和】poj 1050 To the Max
- java元转分以及分转元
- sharepoint 代码创建列表
- 深入解析Gtest
- tomcat的时候,就会报各种类找不到的错误
- spring jdbcTemplate使用
- POJ 1050 To the Max ——二维最大子段和
- OFA计算折旧运行慢
- linux shell 中行末尾的"&" 的作用
- mongodb update操作
- backbone链接node服务器 session保存失败或每次都是新的链接
- ScrollView和ListView一起使用 文本换行getMeasuredHeight等问题的解决
- java 其他文件转成pdf java生成pdf
- 微软100题-天天做-第36题
- python数据结构与算法 24 汉诺塔问题(河内塔问题)