Re: [algogeeks] Special String

2011-08-28 Thread DeVaNsH gUpTa
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 It is also a dp of form f(n)=a*f(n-1) + b*f(n-2) -- Thanks and Regards *Devansh Gupta* *B.Tech Third Year* *MNNIT, Allahabad* -- You

Re: [algogeeks] Special String

2011-08-21 Thread Amol Sharma
thnx...don't bother got AC...was doing a silly mistake -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad

Re: [algogeeks] Special String

2011-08-21 Thread Amol Sharma
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 go

Re: [algogeeks] Special String

2011-08-21 Thread Amol Sharma
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

Re: [algogeeks] Special String

2011-08-21 Thread vaibhavmittal11
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 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'..