buy1get1 wrong answer help

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

please help getting wrong answer

problem link http://www.codechef.com/problems/BUY1GET1

i think there are some unnecessary spaces in the test file. i replaced “gets()” with “cin” and got accepted. accepted solution http://www.codechef.com/viewsolution/3313744.
hope this helps :slight_smile:

1 Like