minCost[n] = the minimize cost on the nth day.
iceCream[n] = the pints of ice cream demanded on the nth day
the whole price of ice cream should be the sum of pints * price, it will never change.
on day 1, the shop must pay shipping fee. minCost[0] = shipping_cost.
if the remaining ice cream cannot satisfy the demand on that day, the shop has to ship more, cost = shipping_cost + overnight_cost, so they should avoid this situation. Therefore, we only compare shipping_cost with overnight_cost.
minCost[n] = min { shipping_cost + minCost[n-1], overnight_cost * iceCream[n] + minCost[n-1] }
however, when max_capacity is not big enough, the remaining ice cream cannot satisfy the demand on next day, they have to ship.
if( ( max_capacity - iceCream[n-1] ) < iceCream[n] )
minCost[n] = shipping_cost + minCost[n-1]
Am I right?