Logic behind cell mitosis DP

I wanted to know how to write the recursive definition for this problem:
https://hack.codingblocks.com/contests/c/204/646

Also please tell the logic behind the solution

Thanks!