Submit | All submissions | Best solutions | Back to list |
HS09UBT - UBoat |
A submarine traveling at speed V [m/s] sends a supersonic impulse of frequency F1 [kHz]. The signal bounces off a ship and comes back after time T [s] with frequency F2 [kHz]. Speed of sound in water equals 1450 [m/s]. Calculate the distance between the submarine and the ship in meters.
Input
There is K (1<=K<=30000) lines of standard input. Each consists of four numbers T, V, F1, F2 (1<=T<=3000, 0.1<=V<=20, 20<=F1, F2<=20000) separated by spaces. There T – time of the supersonic impulse in seconds, V – speed of the submarine in meters per second, F1 - frequency of the impulse when sending, F2 – frequency of the impulse when received. All the input values are given with 0.1 accuracy. In the line number K+1 there are four zeros which should not be processed.
Output
Write K lines of output consistent with the input. In each line the distance between the submarine and the ship in meters.
The judge will allow relative error up to 1 percent.
Example
Input:
4 1.5 30 31 5 2.1 35 37 0 0 0 0
Output:
2900 3625
Scoring
For solving this problem you will score 10 points.
Added by: | Adam Dzedzej |
Date: | 2010-01-20 |
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) |