EternalPurposE
❔ Can someone help with this task in C#, it should be done with recursion
Yes, I think this is the the number. it is not necessary to travel 20 liters or 200 km every time. First we travel -20l. One forward to 200 km and we leave the barrel, we refuel from it, it is already -40 and we return for the second. Then we get the second and refuel again from the second -80 and return for the third, it became -100 liters and -1 barrel. Then again with 20 liters of consumption to the 400th kilometer forward and back for the two left barrels and it becomes -60. At 400 kilometers we have 2 barrels - one with 100 liters, and the other with 40 liters. Now we divide 20 liters by 3 so we can go another 66.6667 kilometers with both barrels and from there we have a barrel with 20 and a barrel with 100, we refuel from the one with 20 and then we continue from the one with 100 and it becomes 1200. That is how it becomes 1200 + 400 + 66.66667
14 replies