|
|||||||||||||||||||
|
SPOJ time: 2012-05-26 14:02:16 |
Minimal distanceProblem code: HS09MIN
Matt and Filip love to ride a bike. Matt is currently riding west to east at constant speed VM [m/s], and Filip is riding south to north at constant speed VF [m/s]. Both of them started riding at the same time, when Matt was DM [m] before a crossroads and Filip was DF [m] past the same crossroads. Calculate the smallest distance at which Matt and Filip will be from each other during their ride.
InputIn N(2 ≤ N ≤ 60 000) lines of standard input there are four integer values VM, DM, VF, DF (2 ≤ VM, DM, VF, DF ≤ 100 000 000) separated by spaces. In line N+1 there are four zeros separated by spaces. Do not process this test case. OutputWrite out N lines to standard output. For each test case, write the minimal distance between Matt and Filip in a separate line. Preserve the order of lines from the input. The relative error of your result shouldn't exceed 0.000001 ExampleInput: 17 286 34 139 12 130 9 107 31 309 22 74 38 192 26 73 29 50 27 118 0 0 0 0 Output: 317.96887 ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||