BRI - Bridge
Find a place to build a bridge over the river, so as to minimize total cost of the route between two cities A and B, located on opposite sides of the river.
There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of test cases to follow. Each test case is exactly one line, containing six integers a, b, c, h, s1 and s2 (0 < a, b, c, h, s1, s2 < 100), separated by spaces. a - the distance from city A to the river (the length of segment AE in the figure), b - the distance from city B to the river (the length of segment FG in the figure), c - the distance between A and B along the axis parallel to the river (the length of segment BF in the figure) and h - the width of the river (EG in the figure). s1 and s2 are the costs of unit of road and bridge respectively.
For each test case your program should write a single number to the standard output, equal to the minimal total cost of the route between A and B, accurate up to two digits after the decimal dot.
1 1 1 1 1 1
(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
could someone with AC please post solution for
well i am lagging:
position of C,D which we have to find is an integer right?
@Chinmay:-well i think taking this as refraction of light will solve it..and on my pc the results are perfectly fine..but here i m getting TLE...dont know how to solve the equation for sine of theta....so actually i m increasing the value of theta by 0.001 until the theta doesn't satisfy the equation...i know it's bad algo but i dont have any other choice...if u find anything else on this then please tell me..i m stuck on this...Last edit: 2010-05-11 09:55:35
Reborn In Fire...:
can ne1 suggest some page or give a hint??
1e-9 is enough :)
Tony Beta Lambda:
Epsilon is quite small. 1e-12 is okay.