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 ...
随机推荐
- gradle使用国内源
// 设置 maven 库地址 repositories { maven { url 'http://maven.oschina.net/content/groups/public/' } } ...
- Jsp页面里引入一个javascript文件,在jsp的onclick里怎么添加脚本文件里的方法
举个简单例子:首先新建use.js文件内容:function show(){ alert("aa");} 建html文件跟use.js放同目录下: <html>< ...
- Mac下修改默认的Java版本
今天在安装Elicpse IDE的时候,发现提示安装的Java版本不支持,于是在官方去下载了Jre最新版本并安装,在安装完过后再次打开Elicpse发现提示还是不正确,如果用Google查询到一些资料 ...
- DZ升级到X3.2后,UCenter用户管理中心进不了了
前天将DZ升级到X3.2后,UCenter用户管理中心进不了了,输入的密码也对,验证码也对,就是点登录后没反应,又回来输入前的状态.如果更换密码后,显示密码错误,证明密码是没错的.但就是进不了.大家看 ...
- [DevExpress]SplitContainerControl使用小计
1.修改成纵向分割 Horizontal = false; 2.设置伸缩箭头 3.固定某个PANEL大小 最大化后依然保持着比例 4.隐藏某个PANEL splitContainerControl1. ...
- VS2013中Django流水账笔记--配置环境
一.开发环境 Win7 64位搭建开发环境.需要准备VS2013.Python34.PTVS2013. 1.http://pytools.codeplex.com/ 下载工具,下载之后进行安装即可,我 ...
- mui 重写back 调用back方法,实现返回就即时刷新页面
需求: 从A-----b页面 B操作完后再返回A ,这时A页面数据变化 1.先是针对安卓机可以点击按钮返回,也可以用本机的返回键返回 监听本机的返回按钮,如果点击就调用写好的自定义刷新事件 (fun ...
- HTML5-原声拖放
最早在网页中引入js拖放功能的是IE4,并且只可以拖放图像和某些文本.IE5.5以后网页中的任何元素都可以进行拖放.HTML5以IE为实例制定了拖放规范.FireFox3.5.Safari3+和Chr ...
- MYSQL Error 2006HY000:MySQL server has gone away的解决方案
MySQL server has gone away有几种情况. 1.应用程序(比如PHP)长时间的执行批量的MYSQL语句. 最常见的就是采集或者新旧数据转化. 解决方案: 在my.cnf文件中添加 ...
- 转:jQuery.fn.extend与jQuery.extend到底区别在哪?
还是先吐个槽,网上都都是转载抄袭,基本上就那么一两篇文章,说的还不清楚.... 正文: 其实说白了,从两个方法本身就能看出来端倪. 我们先把jQuery看成了一个类,这样好理解一些. jQuery.e ...