will this makes the logic simple. want to find F(D,B) I drop an egg from some floor, if it breaks it will break on some floor below, and I have left B-1 breaks and D-1 drops. If it doesn't break I have to find a floor above the current floor and have B breaks and D-1 drops. so total breaks become, 1 + F(D-1, B-1) + F(D-1,B)
So you will start droping in the floor F(D-1,B-1)+1; then you move accordingly up or down. when B= 0, F(D,B) = 0 when B= 1, F(D,1) = D if D != 0 For solving you can make a 2d array and tryout. On 9/8/09, Sergey Ochkin <och...@gmail.com> wrote: > > The problem statement looks quite clear to me. Specifically, it tells > that every test case in input file is "solvable", which means that > there is an algorythm for determining the lowest floor where the egg > breaks... > However I discovered an inconsistency in the first (small) input file. > It contains the following test case: 63 7 3. > I simply do not believe that it is possible to determine the lowest > crash-floor in a 63-floor building with only 7 drops and 3 breaks! > Can anyone give a hint if I am mad or the test case is incorrect? > -- > On Sep 8, 5:45 pm, Paul Smith <paulsmithena...@gmail.com> wrote: >> The sample input has 2 test cases. The first, 3 3 3, tell you that >> Solvable(3,3,3) is true. So, you are asked, >> >> what is the maximum number F such that Solveable(F,3,3) is true, >> what is the minimum number D such that Solveable(3,D,3) is true, >> what is the minimum number B such that Solveable(3,3,B) is true. >> >> The answer for this case is 7 2 1, as S(7,3,3), S(3,2,3) and S(3,3,1) >> are all true. >> >> Similarly, given that S(7,5,3) is true, S(25, 5, 3), S(7,3,3) and >> S(7,5,2) are all true, 7 5 3 -> 25 3 2 >> >> On Tue, Sep 8, 2009 at 1:48 PM, LeppyR64<jlep...@gmail.com> wrote: >> >> > I'm having trouble understanding the problem statement. >> >> > I understand what is expected for output, but not how to get from the >> > sample input to the output. >> > Could someone please explain the sample test case? >> >> -- >> Paul Smithhttp://www.nomadicfun.co.uk >> >> p...@pollyandpaul.co.uk > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-code@googlegroups.com To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-code?hl=en -~----------~----~----~----~------~----~------~--~---