In-circles Again
Time limit1sMemory limit128 MB
Each circle tangent to two sides of a triangle and its incircle has radius r divided by the sine of a half-angle; recover the three angles from r, r1, r2, r3 and compute the area.
- Level
Medium4 of 10
- Topics
- Geometry, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
The figure below shows triangle together with its in-circle (the circle that touches all three sides of the triangle from the inside). The radius of this in-circle is . Three more circles are drawn; each of them touches two sides of the triangle and the in-circle of . The radii of these three circles are , , and .

Given the values of , , , and , find the area of triangle .
Input
The input consists of up to datasets. Each dataset holds four positive floating-point numbers , , , and in that order. The input is terminated by a dataset of four negative numbers.
The values are separated by whitespace (including newlines), so a single dataset may span several physical lines. Read the values as whitespace-separated tokens rather than line by line.
Output
For each dataset print one line in the format Case k: A, where is the -based dataset number and is the area of triangle shown to two digits after the decimal point. You may assume that a triangle can always be constructed from the given , , , . If needed you may take and use double-precision floating-point numbers. No input is given for which small precision errors would change the printed output. Refer to the sample output for the exact format.