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 ...
随机推荐
- c++ 继承学习笔记
三大继承原则(由我杜撰) 基类的私有成员被继承后不可见(优先级最高) 公有继承不改变基类成员属性 保护继承(私有继承)把基类成员变为保护成员(私有成员)
- HowTo: SVN undo add without reverting local changes
Reference: http://stackoverflow.com/questions/5083242/undo-svn-add-without-reverting-local-edits svn ...
- php configure help
`configure' configures this package to adapt to many kinds of systems. Usage: ./configure [OPTION].. ...
- vsftpd.conf配置详解
根据 /etc/vsftpd/vsftpd.conf默认配置给出设定功能 # Example config file /etc/vsftpd/vsftpd.conf # The default c ...
- 分页 page
1.根据条件计算出数据的总数 2.import(page类); 3.实例化分页类 4.设置相关的参数 5.调用show()方法 // 导入分页类 import('ORG.Util.Page');$p ...
- winform水晶报表编译错误,未能加载文件或程序集"file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framewor "
未能加载文件或程序集“file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Commo ...
- PHP中如何设置error_reporting错误报告级别
错误报告级别:指定了在什么情况下,脚本代码中的错误(这里的错误是广义的错误,包括E_NOTICE注意.E_WARNING警告.E_ERROR致命错误等)会以错误报告的形式输出. 设置错误报告级别的 ...
- CentOS安装mplayer
据说mplayer相当于windows下的暴风影音,那么今天就来安装上mplayer. 安装的大体步骤: 安装mplayer需要安装,解码器,mplayer,皮肤. 这三个包你都可以在mplayer官 ...
- 微信获取用户的openid和详细信息
获取用户的信息的原理,首先用户会点击一个url,这个url会包含一个参数redirect_uri,这个url是指向微信那边的服务器的,然后微信会把这个http请求重定向到redirect_uri,即我 ...
- OpenFileDialog组件打开文件....待续
1.常用属性 InitialDirectory 对话框的初始目录 this.openFileDialog1.InitialDirectory = "d:\\"; ...