|
||||||||||
The Happy TrianglesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 355 Accepted Submission(s): 75 Problem Description Alice has a toy, which was made up by two parts. The first part is a frame consisting of one horizontal stick and two vertical sticks. The distance between the two vertical sticks is R. And the horizontal stick is long enough. The second part of her toy is N triangles. These triangles can be fastened on the frame with one of their edges on the horizontal stick. Once they are fastened, they can slide along the horizontal stick. And magically, they can overlap each other. (See pic 1) Now, Alice wants to maximize the total area covered by these triangles between the two vertical sticks. Note £º 1. The triangles DON¡¯t have to be totally between the two vertical sticks. But the area out of the two sticks should not be taken into consideration. 2. These triangles are either acute triangle or right triangle. Input There are several cases. The first line of the input is a single integer T. (T<=100) For each case, the first line contains two integers N ,R. (N<=1000,R<=100000) The next N lines, each line contains three integer a,b,c , which stand for the lengths of three edges of the i-th triangle. (0<a<=b<=c<100000,a2+b2>=c2). Output For each case, output "Case #X: " first, X is the case number starting from 1. Then output the maximum area Alice can use these triangles to cover between the two sticks, round to 3 decimal places. Sample Input
Sample Output
Source | ||||||||||
|