Thursday, August 13, 2009

toaster

总共有3000只香蕉,有一只骆驼每一次只能带 1000只香蕉,每1公里吃1只香蕉,没有香蕉吃
它是不肯走的,A-B 点距离1000公里,如果这个骆驼要从A点到B点有什么办法可以让更
多的香蕉剩下来?如何做到?如何最有效率的运最多的香蕉到B点?

第一次到200Km处放下600橡胶返回
第二次到2OOKm处再装上200橡胶前行,到533KM处放下334橡胶返回,返程中在200Km在装200
第三次在200Km处装上200橡胶前行,在533Km处装上333橡胶前行,此时还是满载1000橡胶
最后剩下533橡胶
问题的焦点在于,如何使最后满载点(1000香蕉)离终点最近?而此时已经消耗了2000=2X(第一次距离)+3Y(第二次距离),所以还得必须使X最短,而5X大于等于1000才不至于浪费(丢在路上)橡胶。

故第一次200Km
第二次533Km

(1) it can be proved that the intermidate points must be the same.
(2) the first distance can be 100m, 200m, etc. it makes no difference. the key point is to reduce the number of rounds. comsuming the first 1000 bannas. divided by 5, then it is 200m. the second round, divided by 3

这个问题是不是可以这么延伸:

3k 香蕉 路上停两次, 4K香蕉 是不是就变成

2x + 2y + 3z = 3000

并且 7x >= 1000, 5 (y-x) >= 1000

x = 142 y = 342 z = 675

5k 香蕉 就是

111, 253, 453, 786

以此类推, n k 香蕉最佳路径为

point 1 = 1000/ (2n-1),
point 2 = p1 + 1000 / (2n-3)
point 3 = p2 + 1000 / (2n-5)
...
keep this until (2n-x) <= 1


基本上就是每进一步都消耗1000香蕉, 这样不浪费运力

到2n-1 > 15的时候, 开始溢出, 保证能运到终点, 也就是需要8k香蕉, 保证必有至少1k香蕉到终点...

0 comments: