Desert crossing - script

An explorer wants to cross a desert with camel teams. (debug)
Each camel can carry Q = food.
A camel eats c = food/km
A driver eats as much as p camels : p×c = food/km
At every step, a driver returns with his ri camels, after reloading the other camels to full load, keaping just enough to return with his camels, and letting a deposit for those who will return later.
Explorer reaches target with his camels,
with no more food          and returns.
The last driver has camels
The others (numbered from the end) :

ri+1 = ×∑ri + ×ri + ×i +
How many camels and drivers to reach km ?

Method

Last step : x0 = (Q/c)×r0/(r0 + p)
If explorer returns : x0 = (Q/2c)×r0/(r0 + p)
Current step :
n camels go on for next step with i drivers
s camels and m drivers return from further steps
If explorer returns : s = n, else s = n - r0, similarily m = i or i - 1

 ri×Q/c = (2ri + n + s + p(m+i+2))×xi 

and for a given step xi :
  ri = (n + s + p(m+i+2))×xi×c / (Q - 2c×xi

 

Home Arithmetic Geometric Misc Topics Scripts Games Exercices Mail Version Française Previous topic Next topic