|
|||||||||||||||||||
|
SPOJ time: 2012-02-09 02:00:39 |
UBoatProblem code: HS09UBT
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. InputThere 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. OutputWrite 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. ExampleInput: ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||