*I GUESS THE example u have cited is a bit incomplete, as in you havent included anything for the 3rd item . If you want to buy all items then some provision for the 3rd item has to be made as well. Coreect me, if I am wrong.*
On Sun, Aug 14, 2011 at 7:21 PM, Prakash D <[email protected]> wrote: > no one to help ?? > > > On Sat, Aug 13, 2011 at 10:48 PM, Prakash D <[email protected]> wrote: > >> 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. > -- R@$!-! "DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS." -- 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.
