Here is the problem
and here is my solution CodeChef: Practical coding for everyone
I got a correct answer for this one but I want to ask if there is another way of solving this kind of problem. If there is an editorial for this problem, can you send me the link? Thanks