Help on approach of ICM2001

Hi, Can anyone please explain the approach of CodeChef: Practical coding for everyone