Submit | All submissions | Best solutions | Back to list |
HS09MIN - Minimal distance |
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.
Input
In 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.
Output
Write 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
Example
Input: 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
163.6
239.180354
168.66674
128.156155
Scoring
For solving this problem you will score 10 points.
Added by: | Adam Dzedzej |
Date: | 2009-10-17 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TCL TEXT WHITESPACE |
Resource: | High School Programming League (thanks to Talent Association) |