You're quite close but it's possible to optimize. I've taken more or less the same approach but I did a mistake in my calculations the first time, so I did it again by looking for that expression.

The idea is to take steps that leave a multiple of 1000 bananas, because they dictate how many trips are necessary, and thus the cost for each step. So the expression is the cost in banana/km for each of those steps.

1) We could consume the 1000 first bananas, by a lucky guess:

- take 1000 to L200, there's 800 remaining. Drop 600 and get back to L0 (400 eaten)

- take 1000 to L200, drop 600 and get back to L0 (400 eaten)

- take 1000 to L200, drop 800 (200 eaten) => 2000 left.

That's a cost of 1000 for 200 km, so 5 banana per km. That's normal since 3000 bananas require 3 transports, 2 back & forth and 1 final, so

**2*2+1** bananas per km.

2) Let's use that approach for the 2nd step. Now there's only 2000 bananas, so 2 transports required, 1 back & forth and 1 final, we expect 2+1 = 3 bananas per km.

To consume 1000 bananas, it would take 333 + 1/3 km. Let's do that and we arrive at L200+333+1/3 = L533+1/3, with only 1000 bananas left.

Or said otherwise,

- take 1000 to L200+333+1/3, drop 333+1/3 (hoping the 1/3 doesn't rot), get back to L200 (666+2/3 eaten)

- take 1000 to L200+333+1/3, drop 666+2/3 (333+1/3 eaten).

3) Final trip, we have 1000 - (533+1/3) km to travel, and the camel eats as many bananas. This leaves us with:

1000 - (1000 - (533+1/3)) =

**533+1/3 bananas**. Not efficient but after all it's in the desert.

My first reaction was that there would be no banana left, since it would eat all of them, it's quite counter-intuitive.