This could be a classic puzzle, similar to the previous one on the horse race, with the following topics:
You are a coal miner in Shanxi, you have 3000 tons of coal mining in the mining area to be shipped to the market to sell, from your mining area to the market is 1000 kilometers, you have a coal-burning train, the train can only be loaded with 1000 tons of coal, and its energy consumption is relatively large-each kilometer needs a ton of coal. Excuse me, as a programmer who knows how you can transport the coal to the market?
The problem initially seems to be non-solution, because your train consumes a ton of coal per kilometer, and to the destination is 1000 km, and the train can only be 1000 tons of media. If your train can be fully loaded, the destination will be burned all the light, not the slightest left. Therefore, many people's first reaction is that this is not likely.
This is normal if you feel that it is not possible at first. But I do not know whether you will continue to think, if you do not want to think about, then I am very worried about you, because you may not be a good thinker, but a fear person, and may be a easy to give up people. This may not be appropriate for you to do a good job as a programmer who needs a lot of thinking.
I didn't think it was possible at first, and then I thought about a solution that could carry up to 500 tons of coal to the market, as follows: (I hope you think about it first and then see the answer)
- Pack 1000 tons of coal, walk 250 kilometers, drop 500 tons of coal, back to the mine.
- Pack 1000 tons of coal, walk to 250 kilometers, pick up 250 tons of coal to continue forward to 500 kilometers, dropped 500 tons of coal, back to the mine. At this time there are 250 tons on the train, plus 250 tons of coal at 250 kilometers, so the train can go back to mine.
- Put on the last 1000 tons of coal, go to 500 kilometers, install the 500 tons of coal there, and then go to the goal.
Therefore, you can transport up to 500 tons of coal to the market (of course, the train will not go back, because the mine has no coal)
It seems like this is good, but there are better ways to transport more media in the past. Do you know this method? It can be suggested that the idea is to use this method. I will not put the answer in the first place, you can think for yourself. I'll put the answer up in a couple of days.
Idea 1:
Suppose the train fills 1000T at a time, drives 1Km, unloads 998T, and leaves 1T to go back. So the train takes all the coal to 1Km and consumes 5T. The last time I don't need to go back. The conclusion is that more than 2000T of coal needs 5t/km consumption. So move forward, to the place where 200Km, There's 2000T of coal left.
The next section of the road, 1000T to 2000T between the coal, the need for 3t/km consumption. How far is the point to reach the next point (still 1000T left)? 1000t/3t=333.33km
Finally, the car in the 533.33Km is still left 1000T coal, full load to reach the end, there is 533.33T left
Mathematical Description:
The first step is to transfer the coal to the middle point B three times.
The second step, two times the coal to the middle point C
The third step is to transport the coal to destination D.
First step: 5* (AB) = 1000; solution ab=200
The second step: 3*BC = 1000; solution to bc=333.
The third step: ab+bc+cd=1000, the solution to cd=467
Therefore, long haul 533 tons of coal to the destination
Updated (April 17, 2011): Everyone is very smart, 533 is supposed to be the optimal solution, we have used a lot of methods to elaborate this process, my original idea and friends Xpacificcoolshell the same! It is good to see a more scientific solution, educated. In addition, there are some friends put forward the train can not turn around the actual situation, very good, so, after this problem can not be transported by train coal, may be a better horse to carry grass. ;)
"Turn from" http://coolshell.cn/articles/4429.html/comment-page-1#comments
The problem of transporting coal by train