Problem B. Harvest of Apples

HDU - 6333