(简单) 不需要算法 HOJ 1019 Grandpa\'s Other Estate
来源:互联网 发布:碧柔防晒知乎 编辑:程序博客网 时间:2024/06/05 19:07
Grandpa's Other Estate
Submitted : 596, Accepted : 272
From our previous contest, we know that Kamran the Believer inherited many of his grandpa's belongings. Apparently, his grandpa had been a mathematician in his life with interests in puzzle solving, since he has made Kamran solve another programming problem!
Grandpa had a big garden with many valuable walnut trees. He has written in his will that Kamran can inherit one piece of square shaped land of a given size in the garden, such that its sides be parallel to the x and y axes. Taking advantage of the fact that no other restrictions have been mentioned in the will, Kamran wants to choose the land in which the most number of trees lie. Kamran is too wealthy now and thus too lazy to spend time and solve another algorithmic problem. He has hired you to solve this problem for him.
You are given the location of all trees in the big garden and the size of the land to choose. You are to write a program to find out where to choose the land so that the most number of trees lie in it. You may consider trees as points in the plane and the land as a square. You are to find the position of the square such that it includes as many points as possible. Note that the points on the border of the square are considered to be inside it.
Input
The first line of the input file contains a single integer t (1<=t<=10), the number of test cases, followed by the input data for each test case. The first line of each test case contains an integer n (1<=n<=100), the number of trees, and an integer r (1<=r<=1000), the length of the land's side, followed by n lines, each containing two integers x and y (0<=x , y <= 100,000) representing the coordinates of a walnut tree. Note that all coordinates are pairwise distinct.
Output
There should be one line per test case containing the maximum number of trees that Kamran can own.
Sample Input
13 11 22 14 3Sample Output
2
- (简单) 不需要算法 HOJ 1019 Grandpa\'s Other Estate
- HOJ 1019 Grandpa's Other Estate
- HOJ Grandpa's Other Estate——(离散化思想的复习)
- POJ 1356 Grandpa's Other Estate 笔记
- POJ1228 Grandpa's Estate
- pku1228 Grandpa's Estate
- poj1228 - Grandpa's Estate
- POJ1228--Grandpa's Estate
- poj Grandpa's Estate
- POJ1228-Grandpa's Estate
- Grandpa's Estate
- Poj1228 Grandpa's Estate
- Grandpa's Estate
- Grandpa's Estate POJ
- POJ 1228 || Grandpa's Estate(凸包andrew算法
- poj 1228 Grandpa's Estate
- POJ 1228 Grandpa's Estate
- POJ 1228 Grandpa's Estate
- (简单) 博弈 HOJ 2128 S-Nim
- (中等) 最短路 HOJ 2132 Easter holidays
- Android之菜单一——选项菜单
- (中等) 动态规划 HOJ 2177 ICPC Strikes Again
- (中等) 树形dp HOJ 2178 Optical Fiber
- (简单) 不需要算法 HOJ 1019 Grandpa\'s Other Estate
- *数论 HOJ 3110 Remoteland
- 博弈论 HOJ 1122 Number Game
- 字符串(最小表示法) HOJ 1223 Hidden Password
- 搜索 HOJ 1266 Phone Home
- 搜索 HOJ 1281 Lagrange\'s Four-Square Theorem
- *搜索 HOJ 1320 Square Destroyer
- 概率dp ZOJ 3640 Help Me Escape
- 并查集 HOJ 2064 Journey to Tibet
程序博客网,程序员的互联网技术博客家园。csdn论坛精品 msdn技术资料都在这里