Can anyone suggest how can I approach this problem:-
https://www.codechef.com/FFC22019/problems/FFC219A
I have looked at few submissions, most of them are using the similar type of approach, but I'm not able to understand the concept behind it. Any help is appreciated.