首页 > 代码库 > hdu 5243 Homework
hdu 5243 Homework
Homework
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 413 Accepted Submission(s): 48
Problem Description
As this term is going to end, DRD needs to start his graphical homework.
In his homework, DRD needs to partition a point set S into two part. You can see that if one part has 100 points and the other has only 1 point, then this partition cannot be beautiful since it‘s too imbalanced. DRD wants to find a line to separate S, so that no points lie in the line and there are at least ⌊|S|3⌋ points in each side of the line. DRD finds it amazing that there may exist some points (no need to be in S) that if a line l passes it and does not pass any points in S, then l can be a separating line. Now, he wonders the area these points form.
In his homework, DRD needs to partition a point set S into two part. You can see that if one part has 100 points and the other has only 1 point, then this partition cannot be beautiful since it‘s too imbalanced. DRD wants to find a line to separate S, so that no points lie in the line and there are at least ⌊|S|3⌋ points in each side of the line. DRD finds it amazing that there may exist some points (no need to be in S) that if a line l passes it and does not pass any points in S, then l can be a separating line. Now, he wonders the area these points form.
Input
First line: a positive integer T≤10 indicating the number of test cases.
There are T cases following. In each case, the first line contains an positive integer n≤1000, and n lines follow. In each of these lines, there are 2 integers xi,yiindicating a point (xi,yi) in the plane. Note that |xi|,|yi|≤104
You can assume that no three points in S lies in the same line.
There are T cases following. In each case, the first line contains an positive integer n≤1000, and n lines follow. In each of these lines, there are 2 integers xi,yiindicating a point (xi,yi) in the plane. Note that |xi|,|yi|≤104
You can assume that no three points in S lies in the same line.
Output
For each test case: output ‘‘Case #x: ans‘‘ (without quotes), where x is the number of the cases, and ans is the area these points form.
Your answer is considered correct if and only if the absolute error or the relative error is smaller than 10−6.
Your answer is considered correct if and only if the absolute error or the relative error is smaller than 10−6.
Sample Input
241 11 -1-1 -1-1 18-1 -1-1 11 -11 1-2 -2-2 22 -22 2
Sample Output
Case #1: 4.000000Case #2: 5.333333
Source
hdu 5243 Homework
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。