Need Help -To Approach this Question

can anyone help me out with this question
https://www.codechef.com/problems/PROC18C
im not able to approach this question