In a triangle ABC, the sides a,b,c are given, then a point D on side BC is taken and length AD is given, Now i have to choose E and F on AB and AC such that triangle DEF has got minimum perimeter.
The problem
You are given a triangle ABC, specified by the sides BC, CA, and AB and a point D on BC, specified by the length AD (if 2 such points are possible, dont worry, they both give the same answer). You are to find the smallest perimeter of a triangle DEF such that E lies on AB and F lies on AC.
Input
The input will begin with t, the number of test cases. The only line for each test case will provide values for BC,CA,AB,and AD (all values of double data type) separated by single spaces. (All the inputs satisfy triangle inequality, and the given distance AD is such that D is on BC). There will be upto 150 test cases.Output
For each test case, output in a new line, a single real number with 2 digits of precision - the minimum possible perimeter of triangle DEF.Sample Input
2
58.42 37.05 51.42 35.42
45.53 30.34 37.19 27.76
Sample Output
69.94
55.23
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---
