#include <stdio.h>

#include <string.h>

#define mt 101

int main()

{

int a[mt][mt];

int st[mt][mt];

int p,k,n,i,j,sum,maxn;

//freopen("in.txt","r",stdin);

scanf("%d",&n);

for (i=;i<=n;i++)

for (j=;j<=n;j++)

scanf("%d",&a[i][j]);

memset(st,,sizeof(st));

for (i=;i<=n;i++)

    for (j=;j<=n;j++)

   st[i][j]=st[i][j-]+a[j][i];

   maxn=;

    for (i=;i<=n;i++)

    {

for (j=i;j<=n;j++)

{

p=st[][j]-st[][i-];

sum=p;

for (k=;k<=n;k++)

{

if (sum>)

sum+=st[k][j]-st[k][i-];

else sum=st[k][j]-st[k][i-];

if (sum>p) p=sum;

}

if (p>maxn) maxn=p;

}

    }

    printf("%d\n",maxn);

    return ;

}   

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 1050的更多相关文章

  1. poj 1050 To the Max(最大子矩阵之和)

    http://poj.org/problem?id=1050 我们已经知道求最大子段和的dp算法 参考here  也可参考编程之美有关最大子矩阵和部分. 然后将这个扩大到二维就是这道题.顺便说一下,有 ...

  2. POJ 1050 To the Max 暴力,基础知识 难度:0

    http://poj.org/problem?id=1050 设sum[i][j]为从(1,1)到(i,j)的矩形中所有数字之和 首先处理出sum[i][j],此时左上角为(x1,y1),右下角为(x ...

  3. POJ 1050 To the Max -- 动态规划

    题目地址:http://poj.org/problem?id=1050 Description Given a two-dimensional array of positive and negati ...

  4. poj 1050 To the Max (简单dp)

    题目链接:http://poj.org/problem?id=1050 #include<cstdio> #include<cstring> #include<iostr ...

  5. poj 1050 To the Max(线性dp)

    题目链接:http://poj.org/problem?id=1050 思路分析: 该题目为经典的最大子矩阵和问题,属于线性dp问题:最大子矩阵为最大连续子段和的推广情况,最大连续子段和为一维问题,而 ...

  6. POJ 1050 To the Max 最大子矩阵和(二维的最大字段和)

    传送门: http://poj.org/problem?id=1050 To the Max Time Limit: 1000MS   Memory Limit: 10000K Total Submi ...

  7. poj - 1050 - To the Max(dp)

    题意:一个N * N的矩阵,求子矩阵的最大和(N <= 100, -127 <= 矩阵元素 <= 127). 题目链接:http://poj.org/problem?id=1050 ...

  8. poj 1050(DP)

    最大子矩阵和.类似于子序列最大和. // File Name: 1050.cpp // Author: Missa_Chen // Created Time: 2013年06月22日 星期六 17时0 ...

  9. [ACM_动态规划] POJ 1050 To the Max ( 动态规划 二维 最大连续和 最大子矩阵)

    Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any ...

  10. poj 1050 To the Max(最大子矩阵之和,基础DP题)

    To the Max Time Limit: 1000MSMemory Limit: 10000K Total Submissions: 38573Accepted: 20350 Descriptio ...

随机推荐

  1. 2018.10.21 codeforces1071B. Minimum path(dp+贪心+bfs)

    传送门 唉考试的时候写错了两个细节调了一个多小时根本没调出来. 下来又调了半个小时才过. 其实很简单. 我们先dpdpdp出最开始最多多少个连续的aaa. 然后对于没法继续连续下去的用贪心+bfsbf ...

  2. @media screen

    参考地址: http://www.swordair.com/blog/2010/08/431/ http://ashaochangfu.blog.163.com/blog/static/1042517 ...

  3. 百度Webuploader 大文件分片上传(.net接收)

    版权所有 2009-2018荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webapp/up6.2/in ...

  4. Nonsense Alphabet

    Nonsense Alphabet A was an ant Who seldom stood still, And who made a nice house In the side of a hi ...

  5. [Ubuntu Version] 如何在terminal 查看当前 ubuntu的版本号

    命令: locate locate /etc/*release/etc/lsb-release/etc/os-release 命令: catcat /etc/os-releaseNAME=" ...

  6. ORACLE 管道技术应用

    但是使用管道函数的时候是可以返回一个package里面定义的type的. create or replace package test_typeis    type test_type_record ...

  7. Jenkins中执行docker命令报错

    Cannot connect to the Docker daemon. Is the docker daemon running on this host?   在配置Jenkins从Gitlab自 ...

  8. Asp.net MVC5 返回json数据忽略序列化属性

    在属性上添加 [ScriptIgnore] 特性,命名空间是System.Web.Script.Serialization

  9. 403 - 禁止访问: 访问被拒绝(IIS)

    错误如下: 解决方法: 1,点击当前网站主页,选择默认文档 2,添加网站的起始页,我这里是main.htm

  10. JS 中的数据类型转换

    转成字符串 String 1. 使用 toString方法 这种方法可以将 number, boolean, object,array,function 转化为字符串,但是无法转换 null, und ...