Solution for Code Chef Problem 'NUMGAME' (http://www.codechef.com/problems/NUMGAME)