POJ2029——Get Many Persimmon Trees

POJ2029——Get Many Persimmon Trees

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

Get Many Persimmon Trees
Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 3656   Accepted: 2378

Description

Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord of the domain of Aizu, had decided to grant him a rectangular estate within a large field in the Aizu Basin. Although the size (width and height) of the estate was strictly specified by the lord, he was allowed to choose any location for the estate in the field. Inside the field which had also a rectangular shape, many Japanese persimmon trees, whose fruit was one of the famous products of the Aizu region known as ‘Mishirazu Persimmon’, were planted. Since persimmon was Hayashi’s favorite fruit, he wanted to have as many persimmon trees as possible in the estate given by the lord.

For example, in Figure 1, the entire field is a rectangular grid whose width and height are 10 and 8 respectively. Each asterisk (*) represents a place of a persimmon tree. If the specified width and height of the estate are 4 and 3 respectively, the area surrounded by the solid line contains the most persimmon trees. Similarly, if the estate’s width is 6 and its height is 4, the area surrounded by the dashed line has the most, and if the estate’s width and height are 3 and 4 respectively, the area surrounded by the dotted line contains the most persimmon trees. Note that the width and height cannot be swapped; the sizes 4 by 3 and 3 by 4 are different, as shown in Figure 1.



POJ2029——Get Many Persimmon Trees

Figure 1: Examples of Rectangular Estates


Your task is to find the estate of a given size (width and height) that contains the largest number of persimmon trees.

Input

The input consists of multiple data sets. Each data set is given in the following format.

N

W H

x1 y1

x2 y2



xN yN

S T

N is the number of persimmon trees, which is a positive integer less than 500. W and H are the width and the height of the entire field respectively. You can assume that both W and H are positive integers whose values are less than 100. For each i (1 <= i <= N), xi and yi are coordinates of the i-th persimmon tree in the grid. Note that the origin of each coordinate is 1. You can assume that 1 <= xi <= W and 1 <= yi <= H, and no two trees have the same positions. But you should not assume that the persimmon trees are sorted in some order according to their positions. Lastly, S and T are positive integers of the width and height respectively of the estate given by the lord. You can also assume that 1 <= S <= W and 1 <= T <= H.

The end of the input is indicated by a line that solely contains a zero.

Output

For each data set, you are requested to print one line containing the maximum possible number of persimmon trees that can be included in an estate of the given size.

Sample Input

16
10 8
2 2
2 5
2 7
3 3
3 8
4 2
4 5
4 8
6 4
6 7
7 5
7 8
8 1
8 4
9 6
10 3
4 3
8
6 4
1 2
2 1
2 4
3 4
4 2
5 3
6 1
6 2
3 2
0

Sample Output

4
3

Source

版权声明:本文博客原创文章,博客,未经同意,不得转载。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/117516.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 差分数组详解[通俗易懂]

    差分数组详解[通俗易懂]题目:来先看一道裸题,有n个数。m个操作,每一次操作,将x~y区间的所有数增加z;最后有q个询问,每一次询问求出x~y的区间和。思路:很明显,直接用前缀和无法快速满足这个操作,所以我们就用到了查分数组。设a数组表示原始的数组;设d[i]=a[i]-a[i-1](1&lt;i≤n,d[1]=a[1]);设f[i]=f[i-1]+d[i](1&lt;i≤n,f[1]=d[1]=a[1]);设sum[i…

    2022年6月9日
    35
  • static声明静态外部类_static静态变量的理解

    static声明静态外部类_static静态变量的理解在一个类中创建另外一个类,叫做成员内部类。这个成员内部类可以静态的(利用static关键字修饰),也可以是非静态的。由于静态的内部类在定义、使用的时候会有种种的限制。所以在实际工作中用到的并不多。   在开发过程中,内部类中使用的最多的还是非静态地成员内部类。不过在特定的情况下,静态内部类也能够发挥其独特的作用。    一、静态内部类的使用目的。    在定义内部类的时候,可以

    2022年10月11日
    0
  • 数据结构和数据结构导论_数据结构导论pdf百度云

    数据结构和数据结构导论_数据结构导论pdf百度云数据是指所有被计算机存储,处理的对象。数据元素是数据的基本单位,是运算的基本单位,通常具有完整确定的实际意义。数据元素常常又简称为元素。数据元素由数据项组成。在数据库中,数据项要成为字段或域。它是数据不可分割的最小标识单位。数据可有若干数据元素组成,而数据元素又由若干个数据项组成。数据的逻辑结构是指数据元素之间的逻辑关系。所谓逻辑关系是指数据元素之间的关联方式或邻接关系。集合中任何两个节点之间都没有邻接关系,组织形式松散。线性结构中结点按照逻辑关系一次排成一条链,节点之间一个一个依次相连接。树形结构

    2022年8月18日
    3
  • python核心编程

    python核心编程1:正则表达式:正则表达式是包含文本和特殊字符的字符串,该字符串描述一个可以识别各种字符串的模式[A-Za-z]\w+的含义是第一个字符是字母,也就是说要么A~Z,要么a~z,后面是至少一个(+)

    2022年7月3日
    19
  • keil中debug的使用_keil 多线程

    keil中debug的使用_keil 多线程在点这个之前要先烧写一次程序,不然这一次修改后的程序没有烧进单片机里然后在debug模式下点运行,然后再点停止如果代码有问题就会停在有问题的地方不断循环多试几次如果都停在同一个地方就是那里的代码有问题…

    2022年10月15日
    0
  • IntelliJ Idea 常用12款插件(提高开发效率),附优秀主题插件[通俗易懂]

    插件安装方式:新版本IDE安装方式略有不同,不一一赘述1、BackgroundImagePlus这款插件并不能直接提高你的开发效率,但是可以让你面对的IDE不再单调,当把背景设置成你自己心仪的的图片,是不是会感觉很赏心悦目,编码效率会不会因此间接的提高?!使用方法:2、MybatisLogPluginMybatis现在是j…

    2022年4月4日
    447

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号