approach for RGAME(Rupsa and game)

please write your approach for rupsa and game.https://www.codechef.com/JAN16/problems/RGAME.i can’t get it.thanks in adv…

//