3. [10] Mac is trying to fill 2012 barrels with apple cider. He starts with 0 energy. Every minute, he may rest, gaining 1 energy, or if he has $n$ energy, he may expend $k$ energy $(0 \leq k \leq n)$ to fill up to $n(k+1)$ barrels with cider. What is the minimal number of minutes he needs to fill all the barrels?
Answer: 46 First, suppose that Mac fills barrels during two consecutive minutes. Let his energy immediately before doing so be $n$, and the energy spent in the next two minutes be $k_{1}, k_{2}$, respectively. It is not difficult to check that he can fill at least as many barrels by spending $k_{1}+k_{2}+1$ energy and resting for an additional minute before doing so, so that his starting energy is $n+1$ : this does not change the total amount of time. Furthermore, this does not affect the amount of energy Mac has remaining afterward. We may thus assume that Mac first rests for a (not necessarily fixed) period of time, then spends one minute filling barrels, and repeats this process until all of the barrels are filled.
Next, we check that he only needs to fill barrels once. Suppose that Mac first rests for $n_{1}$ minutes, then spends $k_{1}$ energy, and next rests for $n_{2}$ minutes and spends $k_{2}$ energy. It is again not difficult to check that Mac can instead rest for $n_{1}+n_{2}+1$ minutes and spend $k_{1}+k_{2}+1$ energy, to increase the number of barrels filled, while not changing the amount of time nor the energy remaining. Iterating this operation, we can reduce our problem to the case in which Mac first rests for $n$ minutes, then spends $n$ energy filling all of the barrels.
We need $n(n+1) \geq 2012$, so $n \geq 45$, and Mac needs a minimum of 46 minutes.