Programming Geek
Rated 4.7/5 based on 1446 reviews

Area Of The Crazy Ring: TCS CodeVita 2016 Question

Problem : Area Of The Crazy Ring




Scientists have found a strange substance having strange properties. There is one triangular substance called Strange Triangle which has a property that if it is placed inside a circle then it expands until all the corners of the triangle are touching the circle. There is another circular substance called Strange Circle, which when placed inside any polygon, expands such that it becomes the largest possible circle which can fit inside the polygon such that it touches every side of the polygon.
Strange Triangle: 


Strange Circle: 


Now researchers did a strange experiment. They placed a Strange Triangle inside a normal circle and then placed a Strange Circle inside this Strange Triangle. Thus the ring formed by the two circles, the normal outer circle and the inner strange circle is named Crazy Ring. You are provided with the coordinates of the Strange Triangle on coordinate plane and you have to calculate the area of the Crazy Ringformed by the structure, Print "Not Possible" if the ring is not possible to form.

Input Format:
  1. First line contains two space delimited numbers N1 M1 (N1 and M1 can also be negative)
  2. Second line contains two space delimited numbers N2 M2 (N2 and M2 can also be negative)
  3. Third line contains two space delimited numbers N3 M3 (N3 and M3 can also be negative)
Where, (N1, M1) , (N2, M2) and (N3, M3) are x and y coordinates of three points representing the Strange Triangle

Output Format:

Output the area of the crazy ring up to 2 decimal places however calculations are to be performed up to a precision of 11 decimal places

OR

Print "Not Possible" if it is not possible to form the ring
Sample Input and Output


SNo.InputOutput
1
5 5
5 20
20 5 

292.79 
2
5 5
5 5
5 5 

Not Possible
3
5 8
4 3
2 4.34534554521 

17.91

No comments :

Post a Comment