How to calculate grundy number in these problem

Need some explanation on the problem solution on how to calculate the grundy number for each subgame.
http://www.codechef.com/SNACKDWN/problems/SNCK01

1 Like