after spending some more time the dp formula i came up with is f[i] = 3*f[i-2] + 2*( f[i-1]-f[i-2] ); for i>2
f[1]=3, f[2]=9, f[3]=21, f[4]= 51 and f[5]=123 and so on but i am still getting wrong answer with this formula.........plz tell where i am wrong ? plz share some more test cases if u got AC that may help !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad <http://gplus.to/amolsharma99> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> On Mon, Aug 22, 2011 at 12:22 AM, Amol Sharma <[email protected]>wrote: > can you give a little more hint how you got the dp expression.....i'm not > actually able to relate how it's dp.... > > -- > > > Amol Sharma > Third Year Student > Computer Science and Engineering > MNNIT Allahabad > <http://gplus.to/amolsharma99> > <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> > > > > > > On Sun, Aug 21, 2011 at 6:48 PM, <[email protected]> wrote: > >> Hint: It is a dp of the form f(n+3) = a*f(n+2) + b*f(n+1) + c*f(n) >> Figure a, b, c urself.. >> >> VM >> NSIT, Dwarka >> 3rd year, COE >> >> >> On , Amol Sharma <[email protected]> wrote: >> > Plz help me in solving a simple problem on spoj >> http://www.spoj.pl/problems/MAIN113/ >> > >> > i am not able to conclude a general formula for any 'n'........i derived >> one but found it wrong...plz some one guide !! >> > >> > -- >> > >> > >> > >> > >> > Amol Sharma >> > Third Year Student >> > Computer Science and Engineering >> > MNNIT Allahabad >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > -- >> > >> > 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. >> > >> > >> > >> > >> >> -- >> 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. >> > > -- 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.
