A Chocolate Manufacturer's Problem

HDU - 3644