Submit | All submissions | Best solutions | Back to list |
CIRCIRC - Missing Side |
It is well known that every triangle has an unique incircle and an unique circumcircle. Given the lengths of two sides of a triangle, determine the length of the missing side, such that the area between incircle and circumcircle is as small as possible.
Input
Input starts with a positive integer t≈10000 in a single line, then t lines follow.
Each of the t lines contains the lengths of two sides of a triangle, separated by a single space.
All values are given with four digits after the decimal point and are not larger than 100.
Output
For every testcase print the length of the missing side that satisfies the condition given above, rounded to four digits after the decimal point. If there is no unique solution, print "ambiguous" (without quotes) instead.
Example
Input: 2 1.8491 3.5678 7.5000 5.1480 Output: 3.1416 6.0000
Added by: | numerix |
Date: | 2014-12-30 |
Time limit: | 0.5s |
Source limit: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own problem |
hide comments
2021-04-02 20:09:48 David
Determined an equation for radius of incircle and circumcircle in terms of "a" (given side), "b" (given side), and "c" (to be determined). Subtract area of two circles, differentiate with respect to c, and set to zero. Result is a 9th degree polynomial! |
|
2016-04-20 12:05:54 Gavrilo Milicevic
Can someone give me test case where answer is "ambiguous"? |