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

Find the Perimeter

Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 127    Accepted Submission(s): 6


Problem Description
If there is a point P inside or outside a triangle ABC, so that three triangles ABP, ACP, and BCP have equal perimeters, we say P is the perimeter center of triangle ABC, the perimeter of ABP, ACP and BCP is denoted by Q(ABC).


For example, in an equilateral triangle with each side 10 in figure 1, the P at its center satisfies the above condition and Q(ABC)=21.54701 (=10+20/sqrt(3)).


 

Input
Input contains several cases. Each case has one line containing three integers a, b, c, indicating the lengths of the respective sides of a triangle. Note that 0 < a, b, c ¡Ü 100. The input is terminated by three zeros.
 

Output
For each case, you should output the Q(ABC) to five decimal places, if there is a triangle whose side lengths are a, b, c, with a unique perimeter center. Otherwise, output a single -1.
 

Sample Input
10 10 10 30 40 50 18 17 15 1 2 3 0 0 0
 

Sample Output
21.54701 120.00000 36.54972 -1
 

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-05-12 11:19:38, Gzip enabled