FLOOR14 september challenge wa

http://www.codechef.com/viewsolution/4816078

I tried again and again with the same logic as stated in the editorial why was i getting wrong
plz help

//