Mark the up, flat and down parts on the way from A to B as x, y, z respectively. Then:
x+y+z=15,4x+5y+6z=3, 1≤x,y,z≤13.
From the first equation: y=15−x−z, substitute it into the second equation:
4x+515−z−x+6z=3⇔4x−5x=5z−6z⇔20x=30z⇔z=23x.
Then y=15−x−z=15−x−23x=15−25x.
So the required time is:
t=6x+5y+4z=6x+3−2x+83x=3+24x.
The maximum (the minimum) t can be in case of x is maximum (minimum).
Put down the limitation for x, which follow from the condition of the problem:
1≤x≤13, 1≤z=23x≤13⇔32≤x≤326, 1≤y=15−25x≤13⇔54≤x≤528.
Since all conditions have to be fulfilled simultaneously, we have such limitation for x:
1≤x≤528.
If x=1, then z=23 and y=225. If x=528, then z=542 and y=1.
t=6x+5y+4z=6x+3−2x+83x=3+24x.
The maximum (the minimum) t can be in case of x is maximum (minimum).
Put down the limitation for x, which follow from the condition of the problem:
tmax=3+241⋅528=3+307=3097, tmin=3+241⋅1=2473.