To the Max
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 39058   Accepted: 20629

Description

Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the
sub-rectangle with the largest sum is referred to as the maximal sub-rectangle. 

As an example, the maximal sub-rectangle of the array: 



0 -2 -7 0 

9 2 -6 2 

-4 1 -4 1 

-1 8 0 -2 

is in the lower left corner: 



9 2 

-4 1 

-1 8 

and has a sum of 15. 

Input

The input consists of an N * N array of integers. The input begins with a single positive integer N on a line by itself, indicating the size of the square two-dimensional array. This is followed by N^2 integers separated by whitespace (spaces and newlines).
These are the N^2 integers of the array, presented in row-major order. That is, all numbers in the first row, left to right, then all numbers in the second row, left to right, etc. N may be as large as 100. The numbers in the array will be in the range [-127,127].

Output

Output the sum of the maximal sub-rectangle.

Sample Input

4
0 -2 -7 0 9 2 -6 2
-4 1 -4 1 -1 8 0 -2

Sample Output

15

题目大意:

给定一个包含正负数的二维矩阵,子矩阵是任何连续大小大于或等于1*1的子阵的整个数组,这个矩阵的和就等于矩阵中所有元素之和,和最大的子矩阵被称为最大矩阵。

也就是让你输出最大矩阵的和

推荐:http://acm.nyist.net/JudgeOnline/problem.php?pid=104

版权声明:本文为博主原创文章,未经博主允许不得转载。

Poj 1050 分类: Translation Mode 2014-04-04 09:31 103人阅读 评论(0) 收藏的更多相关文章

  1. Poj 2349 Arctic Network 分类: Brush Mode 2014-07-20 09:31 93人阅读 评论(0) 收藏

    Arctic Network Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9557   Accepted: 3187 De ...

  2. 修改MS SQL忽略大小写 分类: SQL Server 数据库 2015-06-19 09:18 34人阅读 评论(0) 收藏

    第一步:数据库->属性->选项->限制访问:SINGLE_USER 第二步:ALTER DATABASE [数据库名称] collate Chinese_PRC_CI_AI 第三步: ...

  3. MS SQL数据批量备份还原(适用于MS SQL 2005+) 分类: SQL Server 数据库 2015-03-10 14:32 103人阅读 评论(0) 收藏

    我们知道通过Sql代理,可以实现数据库的定时备份功能:当数据库里的数据库很多时,备份一个数据库需要建立对应的定时作业,相对来说比较麻烦: 还好,微软自带的osql工具,比较实用,通过在命令行里里输入命 ...

  4. *** glibc detected *** malloc(): memory corruption 分类: C/C++ Linux 2015-05-14 09:22 37人阅读 评论(0) 收藏

    *** glibc detected *** malloc(): memory corruption: 0x09eab988 *** 发现是由于memset越界写引起的. 在Linux Server上 ...

  5. sscanf 函数 分类: POJ 2015-08-04 09:19 4人阅读 评论(0) 收藏

    sscanf 其实很强大 分类: 纯C技术 技术笔记 2010-03-05 16:00 12133人阅读 评论(4) 收藏 举报 正则表达式stringbuffercurlgoogle 最近在做日志分 ...

  6. Mahout快速入门教程 分类: B10_计算机基础 2015-03-07 16:20 508人阅读 评论(0) 收藏

    Mahout 是一个很强大的数据挖掘工具,是一个分布式机器学习算法的集合,包括:被称为Taste的分布式协同过滤的实现.分类.聚类等.Mahout最大的优点就是基于hadoop实现,把很多以前运行于单 ...

  7. PIGS 分类: POJ 图论 2015-08-10 09:15 3人阅读 评论(0) 收藏

    PIGS Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18209 Accepted: 8277 Description Mir ...

  8. 哈希-4 Values whose Sum is 0 分类: POJ 哈希 2015-08-07 09:51 3人阅读 评论(0) 收藏

    4 Values whose Sum is 0 Time Limit: 15000MS Memory Limit: 228000K Total Submissions: 17875 Accepted: ...

  9. Poj 2528 Mayor's posters 分类: Brush Mode 2014-07-23 09:12 84人阅读 评论(0) 收藏

    Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40570   Accepted: 11798 ...

随机推荐

  1. HttpClient Post Form data and get Response String

    DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost("http:/ ...

  2. decode行转列,case when,

    1.行转列 转之前:

  3. 工作中nginx配置文件的一些参数记录

    reset_timedout_connection on 告诉nginx关闭不响应的客户端连接.这将会释放那个客户端所占有的内存空间 tcp_nopush on 告诉nginx在一个数据包里发送许多个 ...

  4. php 提示Warning: mysql_fetch_array() expects

    我的高度代码如下 include("conn.php"); if(!empty($_GET['id'])){         $sql="select * from ne ...

  5. [Linux] Ubuntu Server 12.04 LTS 平台上搭建WordPress(Nginx+MySql+PHP) Part II

    接着上一节继续搭建我们的LNMP平台,接下来我们安装PHP相关的服务 sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5- ...

  6. 从一个标准URL中提取文件的扩展名

    例如:http://www.sina.cn/abc/de.php?id=1  提出php 1. $url = 'http://www.sina.cn/abc/de.php?id=1'; $arr = ...

  7. SRF之数据字典

      框架提供数据字典的配置和显示的功能 字典以编码作为标识,用varchar(50)类型保存字典的编码.   字典的用法 1.在代码里边需要查询字典信息的 可用 Components.DataDict ...

  8. Linux内核学习笔记——VFS

    概念: ①硬链接:若一个 inode 号对应多个文件名,则称这些文件为硬链接.即硬链接就是同一个文件使用了多个别名.硬链接可由命令 link 或 ln 创建. 其特性: 文件有相同的 inode 及 ...

  9. 人脸检测的API例子

    package cliu.TutorialOnFaceDetect; /* * MyImageView.java * Download by http://www.codefans.net * [AU ...

  10. python中的lambda

    lambda表达式返回一个函数对象 例子: func = lambda x,y:x+y func相当于下面这个函数 def func(x,y): return x+y 注意def是语句而lambda是 ...