poj2029Get Many Persimmon Trees(最大矩阵和)
类似最大矩阵 sum存下 枚举最大就是
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
using namespace std;
int sum[][],o[][];
int main()
{
int i,j,n,w,h,a,b;
while(scanf("%d",&n)&&n)
{
scanf("%d%d",&h,&w);
memset(o,,sizeof(o));
memset(sum,,sizeof(sum));
for(i = ; i <= n ;i++)
{
scanf("%d%d",&a,&b);
o[b][a] = ;
}
int s,t;
scanf("%d%d",&s,&t);
for(i = ; i <= w ; i++)
for(j = ; j <= h ; j++)
sum[i][j] = sum[i-][j]+sum[i][j-]-sum[i-][j-]+o[i][j];
int ans = ;
for(i = t; i <= w ; i++)
for(j = s ; j <= h ; j++)
ans = max(ans,sum[i][j]-sum[i-t][j]-sum[i][j-s]+sum[i-t][j-s]);
printf("%d\n",ans);
}
return ;
}
poj2029Get Many Persimmon Trees(最大矩阵和)的更多相关文章
- poj2029 Get Many Persimmon Trees
http://poj.org/problem?id=2029 单点修改 矩阵查询 二维线段树 #include<cstdio> #include<cstring> #inclu ...
- POJ 2029 Get Many Persimmon Trees
Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3243 Accepted: 2 ...
- POJ2029——Get Many Persimmon Trees
Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3656 Accepte ...
- (简单) POJ 2029 Get Many Persimmon Trees,暴力。
Description Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aiz ...
- POJ-2029 Get Many Persimmon Trees(动态规划)
Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3987 Accepted: 2 ...
- POJ 2029 Get Many Persimmon Trees (二维树状数组)
Get Many Persimmon Trees Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I ...
- xtu数据结构 B. Get Many Persimmon Trees
B. Get Many Persimmon Trees Time Limit: 1000ms Memory Limit: 30000KB 64-bit integer IO format: %lld ...
- POJ2029:Get Many Persimmon Trees(二维树状数组)
Description Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aiz ...
- POJ 2029 Get Many Persimmon Trees (模板题)【二维树状数组】
<题目链接> 题目大意: 给你一个H*W的矩阵,再告诉你有n个坐标有点,问你一个w*h的小矩阵最多能够包括多少个点. 解题分析:二维树状数组模板题. #include <cstdio ...
随机推荐
- 08_XML的解析_SAX解析
[对比SAX解析和DOM解析] * 在使用DOM解析XMl文档时,需要读取整个XML文档,在内存中架构代表整个DOM树的DOcument对象,从而对XML文档进行操作,在这种情况下,如果XML文档特别 ...
- 利用C语言获取设备的MAC address
利用C语言获取设备的MAC address MAC address --> Medium Access Control layer address // // http://www.binary ...
- PHP初学留神(二)
1.===比较运算符 记得上上篇中说过===与==的问题.当时说,===还要类型相同.但到底是怎样呢?因为我们知道比较运算符是可以把两个值类型转换的.举个栗子,如果一个数字和字符串比较,则字符串会转化 ...
- AngularJS的使用方法
1.第一个ng demo <div ng-app="" ng-init="name='Kevin'"> <input ng-model=&qu ...
- SQL导入
然后将新窗口中所有内容放到你需要复制的那个数据库中->新建查询->修改第一行 USE[新数据库名]-> 运行这段代码->刷新数据库 基本就是选择源数据库和目标数据库,特别注意的 ...
- SQL Server 修改排序规则
Net stop mssqlserver Setup /QUIET /ACTION=REBUILDDATABASE /instancename=mssqlserver /SQLSYSADMINACCO ...
- hdu 1828 Picture(线段树 || 普通hash标记)
http://acm.hdu.edu.cn/showproblem.php?pid=1828 Picture Time Limit: 6000/2000 MS (Java/Others) Mem ...
- 多个div并排显示的居中问题——来自腾讯的一道面试题
前两天曲面了一下腾讯,被鄙视了... 自己太水了,且面试官对我可能也有点不爽,说什么还没叫我我就去了,可是尼玛写的面试时间是3点40,我特码进去的时候都3点50了,我还以为晚了呢,他妈的. 实现几个d ...
- PHP漏洞全解(五)-SQL注入攻击
本文主要介绍针对PHP网站的SQL注入攻击.所谓的SQL注入攻击,即一部分程序员在编写代码的时候,没有对用户输入数据的合法性进行判断,使应用程序存在安全隐患.用户可以提交一段数据库查询代码,根据程序返 ...
- 如何成为python高手(转)
http://www.cnblogs.com/xupeizhi/p/3207976.html#2896469 如何成为python高手 本文是从 How to become a proficient ...