i am try to solve these question since morning but i am not able to solve this then i see solution from other but i cant get it

so any one can explain me how to solve this

https://www.codechef.com/MAY19B/problems/MATCHS

# Simple math question

**timelimit1**#1

**timelimit1**#4