A person wants to buy ‘N’ pens. There are ‘M’ shops, where each shop has ‘n’ pens in stock, each pen costs ‘p’ and the delivery cost is ‘d’. Find the minimum cost to buy N pens.
10^5
shop 1 has n1 pen and p1 price each
shop 2 has n2 pen and p2 price each
d charge is same and extra applied cost
like if I take 5 pen from shop 1 with cost 10 each and d=2 then total price = 5*10 + 2=52
I thought it like https://leetcode.com/problems/maximum-units-on-a-truck/