k lets assume that there are 10 kinds of item in the shop
price[]={10,20,30,40,50,60,70,80,90,100}
quantity[]={5,5,5,5,5,5,5,5,5,5}

say no.of items having some free discounts : 5

say p,q,r denotes  buying q nos. of p we will get one r for free.. let them
be

5 4 1
2 5 1
8 2 10
9 1 10
1 5 10

explain for this case.. how will u proceed?


On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani <[email protected]>wrote:

> if k is fixed, sort the items according to their price, buy k cheapest
> items & start taking the most expensive item fr free........

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to