@moderator: if you like, it may be the time to move this thread to the algorithm section, as it has nothing to do with vc++ ...

do you agree that the trajectories of the runner and ( of a point of ) the water front are those in post #9 ?

if yes, then

1) you must agree that there's a dependency on the river bed width, or more specifically, of the ratio of that width with the water front distance at time 0; just consider that you cannot escape from an infinite river bed if the water ( approaching you at a finite distance ) is faster than you ... unless your "optimality" criterion does not depend on the ability of escaping or not; in this case, see 2)

2) you must agree that the probability of escape is given by the disequation in post #9, or more generally: w/d < 2*sin(p)/(q-cos(p)) [1] where q is the ratio of the water/runner speed. So you must agree that the question "to maximize the escape probability" is equivalent to maximizing the probability that [1] holds true.

now, if the runner knows all parameters of the problem exactly ( i.e. w/d, q and p ) then the escape probability can be either 1 or 0, being the former when [1] is satisfied; hence, in this case, the solution of the problem is trivially <any> angle satisfying [1] ( there's no single "optimal" value ).

otherwise, if there is some amount of uncertainty on the parameters ( the runner is just estimating them based on some partial knowledge ) then we need to maximize the probability that [1] is true where w,d,q and p are random variables.

This is easy when q and p are fixed ( as implied by the OP problem statement ): the resulting probability is maximized exactly when p is arccos(1/q).

But in general the result will differ arbitrarily depending on the joint probability distribution of the problem variables.

if q < sqrt(2) then the optimal angle is less than pi/4 ( ie away from the water front ); hence, in this case the answer C ( or at least to run at ~45° from the water front ) will give a better chance of escape.

true, but a simplified model ( in this case, linear water front, straight motions, etc... ) can give insights on the qualitative structure of the solution, for example:Originally Posted byMike Pliam

as said above, this is false when the runner is sure that the water front is slower than ~1.4 times his speed ( as in those action films, the runner could find a motorbike or a ferrari just in the middle of the river bed ; of course, keeping in mind that for p going to 0 the escape time goes to infinity, posing a limit on the escape time would mean posing a bound on the optimal angle towards 0 ) ...Originally Posted byMike Pliam