F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Happy Triangles

Time 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
2 1 5 3 4 5 2 4 3 4 5 3 4 5
 

Sample Output
Case #1: 6.000 Case #2: 10.667
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 12:14:59, Gzip enabled