How to Solve this Problem?

DIVISION 1:Problem C

Please if someone could provide detailed explanation of this problem.I went through tutorial but couldn’t follow much.