首页 > 代码库 > hduoj 1077 Catching Fish 求单位圆最多覆盖点个数
hduoj 1077 Catching Fish 求单位圆最多覆盖点个数
Catching Fish
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1217 Accepted Submission(s): 466
Problem Description
Ignatius likes catching fish very much. He has a fishnet whose shape is a circle of radius one. Now he is about to use his fishnet to catch fish. All the fish are in the lake, and we assume all the fish will not move when Ignatius catching them. Now Ignatius wants to know how many fish he can catch by using his fishnet once. We assume that the fish can be regard as a point. So now the problem is how many points can be enclosed by a circle of radius one.
Note: If a fish is just on the border of the fishnet, it is also caught by Ignatius.
Note: If a fish is just on the border of the fishnet, it is also caught by Ignatius.
Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case starts with a positive integer N(1<=N<=300) which indicate the number of fish in the lake. Then N lines follow. Each line contains two floating-point number X and Y (0.0<=X,Y<=10.0). You may assume no two fish will at the same point, and no two fish are closer than 0.0001, no two fish in a test case are approximately at a distance of 2.0. In other words, if the distance between the fish and the centre of the fishnet is smaller 1.0001, we say the fish is also caught.
Each test case starts with a positive integer N(1<=N<=300) which indicate the number of fish in the lake. Then N lines follow. Each line contains two floating-point number X and Y (0.0<=X,Y<=10.0). You may assume no two fish will at the same point, and no two fish are closer than 0.0001, no two fish in a test case are approximately at a distance of 2.0. In other words, if the distance between the fish and the centre of the fishnet is smaller 1.0001, we say the fish is also caught.
Output
For each test case, you should output the maximum number of fish Ignatius can catch by using his fishnet once.
Sample Input
436.47634 7.696285.16828 4.799156.69533 6.2037867.15296 4.083286.50827 2.694665.91219 3.866615.29853 4.160976.10838 3.460396.34060 2.4159987.90650 4.017464.10998 4.183544.67289 4.018876.33885 4.283884.98106 3.827285.12379 5.164737.84664 4.676934.02776 3.87990206.65128 5.474906.42743 6.261896.35864 4.616116.59020 4.542284.43967 5.700594.38226 5.705365.50755 6.181637.41971 6.136686.71936 3.044965.61832 4.238575.99424 4.293285.60961 4.329986.82242 5.796835.44693 3.827246.70906 3.657367.89087 5.680006.23300 4.595305.92401 4.923296.24168 3.813896.22671 3.62210
Sample Output
25511
Author
Ignatius.L
Recommend
We have carefully selected several similar problems for you: 1056 1079 1071 1099 1066
枚举两点,计算已知过两点和半径的圆心。
O(n^3)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。