I think the first problem involves some mathematics...
In this we fix the first bit and if the remaining no. of bits are odd then
we calculate the no. as follows

If we have 2^4=16  then total bits 5 so we do not include this.
Total no. of bits in one less than the given no. (in this eg. 15) is 4.
Fix first bit, no. of bits remaining = 3
Now let 2 bits are 0 and one bit 1. We have total 3!/(2!*1!) = 3
combinations.

Now go for next even no which is 2 in this case again do the same
Fix first bit, no. of bits remaining = 1
Now let 1 bit is 0. We have total 1!/(0!*1!) = 1 combinations.

Next even 0. stop here.
You can go for this by starting from 2 till no. is less than given N


On Tue, Dec 27, 2011 at 7:28 PM, kumar rajat <thebossku...@gmail.com> wrote:

> Hi
> I have jus started to learn DP and I have coded the standard
> algorithms(LCS,etc).
> I have been trying these problems in SPOJ:
>
> http://www.spoj.pl/problems/NOVICE63/
> http://www.spoj.pl/problems/NY10E/
>
> I understand these may be solved elegantly using DP,but I dont get to
> code the same.
> Can any1 help me how to solve these types of problems using DP?
> Any help regarding the same will be greatly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Tasvinder Singh
B.Tech Final Year,
Department of Computer Engineering,
Malaviya National Institute Of Technology, Jaipur.
Contact: +91-9460627331

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to