Solution to problem Feb2013-BUY1GET1

http://www.codechef.com/FEB13/problems/BUY1GET1