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