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 ...
随机推荐
- asp.net 备份和恢复数据库
观看了Insus的视频写下来的,代码可能有点冗长,如有好的想法的,可以多交流. 前台: <form id="form1" runat="server"&g ...
- 06链队列_LinkQueue--(栈与队列)
#include "stdio.h" #include "stdlib.h" #include "io.h" #include " ...
- oninput和onpropertychange
时常会有监听输入框输入的场景,比如新浪微博的发微博输入框: 还有边输入边提示: 以及form表单边输入边验证,当内容为空提示或者改变输入框的样式达到提示效果. 在IE中是onpropertychang ...
- 封装DB类
封装DB类 一般一个类单独书写在一个Php文件中,为了见名知意,会对文件名有一个规范:类名.class.php 第1步: 创建DB类 第2 步: 属性设计 第3步: 初 ...
- 快速开启Windows 的各种任务及 bat(ch)脚本
MSC It is the Microsoft Management Console Snap-in Control File, like services.msc, devmgmt.msc (Dev ...
- 【python】坑,坑,折腾一个下午python 3.5中 ImportError: No module named BeautifulSoup
将语句 from bs4 import BeautifulSoup4 改成 from bs4 import BeautifulSoup 通过 尼玛------------------------! 总 ...
- Python数据库连接池实例——PooledDB
不用连接池的MySQL连接方法 import MySQLdbconn= MySQLdb.connect(host='localhost',user='root',passwd='pwd',db='my ...
- to debug asp.net mvc4
Go to Tools -> Options -> Debugger -> General Uncheck the option Enable Just My Code (Manag ...
- 我的PHP之旅--数据库连接MySQL服务器,添加 删除 查询
PHP连接MySQL服务器 连接MySQL的方法:mysql_connect(); 语法:resource $link = mysql_connect($hostname, $username, $p ...
- Oracle删除所有表
Oracle 清理用户所有的表 PLSQL中执行语句 select 'drop '||object_type||' '||object_name||';' from user_objects; 结果集 ...