Travel optimization

Consider a two-dimensional world with no obstacles. You must go from
point A to point B, and then return to A. When traveling, you can either
walk or take the train. There are only two train stations, C and D, with
trains going in both directions. On the outside, stations have a public
timer displaying the time until the next train. When looking at the
timer, you can decide to either wait for the next train, or to walk to
your destination. Assume that the time displayed when arriving at a
station follows a uniform distribution from 0 to U, and that there is no
correlation between the schedule of the trains in the two directions.
Suppose that it takes no time to enter or leave a train.

Given the positions of the four differents points A, B, C and D, the
walking speed W, the train speed T, and the constant U, can you compute
the minimum expected time to go from A to B, and from B to A, assuming a
perfect strategy?

Input

Input consists of several cases with real numbers, each with the
coordinates of A, B, C and D, followed by W, T, and U. Assume T > W > 0
and U > 0.

Output

For each case, print the expected time to go from A to B, and to go from
B to A, both with four digits after the decimal point. The input cases
have no precision issues.

Problem information

Author: Ivan Geffner

Generation: 2026-01-25T11:15:02.887Z

© Jutge.org, 2006–2026.
https://jutge.org
