The top computer scientists in Canada have just started the Canadian Computing Cancer (CCC), but Jason and William experience a huge problem. As it turns out, the CCC booklets are so poorly stapled that some words on the top left corner of the page cannot be read. Important pieces of info are cut off due to the stapling, such as the name of the problem's protagonist. The CCC cannot provide a PDF version of the problems because those who start late would have an unfair advantage.
Due to this issue, William measures the endpoints of the staples to be at distinct points and where is at the top left corner of the contest package. The x-coordinate increases infinitely as one moves right, and the y-coordinate increases infinitely as one moves down. In order to start the contest, he folds over the first page and makes a crease in a way that maximizes the amount of legible space on the second page. Jason looks at the page and notices that the missing region of the paper forms a right-angled triangle.
What area of paper is left illegible on William's page?
Input Specification
The first line will contain two space-separated integers and .
The second line will contain two space-separated integers and .
The coordinates are distinct points, i.e., .
For 3 of the 15 points, all coordinates will not exceed .
For an additional 3 of the 15 points, and .
Output Specification
Print out the area of paper missing from William's page. An absolute or relative error of will be considered correct.
Sample Input 1
6 1
1 5
Sample Output 1
21.025000000
Sample Input 2
1 1
3 7
Sample Output 2
42.000000000
Comments
Am I missing something?
I'm fairly certain I've taken all possible staples into account, yet I can't get test cases 3, 4, or 5.
Java outputs large doubles in scientific notation. Will this be accepted by the judge?
Yes.
How is sample test case2 even possible?
It is possible that the missing right-angled triangle has vertices , and . The area of this triangle is , which is minimal.
So it's guaranteed that the missing area is a non-degenerate, right angled triangle?
Since coordinates are at least 1, yes.
Am I the only idiot who stuck at the third case first one???