Neat. That solved my problem. Thanks bas & 有D . On Sat, Sep 12, 2009 at 5:39 PM, 有D <[email protected]> wrote:
> in the C=3, N=2 case: > f(3) = f(1) + 1;//when you are miss 3 card, you will get 2 new cards when > you buy a package; > f(1) = 1/3*f(1) + 2/3*f(0) + 1;//when you are missing one card, the > propobility that you will not get a new card is 1/3. > So, f(0)=0; f(1)=1.5; f(3) = 2.5; > > > On Sat, Sep 12, 2009 at 6:33 PM, Roshan Amadoru > <[email protected]>wrote: > >> >> can you show how to get the answer when C=3, N=2.. i'm still a little >> confused to be honest. >> >> bas wrote: >> > Let f(k) be the expected number of packs we need to buy if we still >> > don't have k cards (or we have C-k cards). >> > To solve the problem we need to find f(C). Note: f(0)=0. >> > >> > In the first example C=2; >> > When we buy the first pack, we will get one of the cards we need with >> > the probability 1. >> > f(2)=1*f(1)+1 >> > means that we expect to buy that many packs to get all the cards we >> > need. But we still don't know f(1). >> > For k=1 we have one card we need, and we need to find the other one. >> > When we buy this next pack, we will get the card we already have with >> > a probability 1/2 and the card we need with prob 1/2. >> > f(1)=1/2*f(1)+1/2*f(0)+1 >> > Then: f(1)=2; f(2)=3 >> > >> > >> > >> > >> > >> > On Sep 11, 9:54 pm, qasim zeeshan <[email protected]> wrote: >> > >> >> Hi All, >> >> First of all congrats to all who made it to next round. >> >> >> >> I have seen some codes for Problem C. but didn't understand. Can anyone >> >> please explain both example test cases for Problem C. >> >> >> >> Thanks >> >> >> >> -- >> >> Qasim Zeeshan >> >> >> > > >> > >> > >> >> >> > > > -- > 有D > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" 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/google-code?hl=en -~----------~----~----~----~------~----~------~--~---
