I have tried almost all test cases i can think of, but i am still getting a WA. Can someone please tell me the error in my solution? http://www.codechef.com/viewsolution/5223577 Help is appreciated.

You considered the round off division in your program but question say for fractional division

Let us consider a test case

5 2

1 2 2 2 3

In this first you consider 3 then consider 1 but actually ball rebounds to 1.5 so you have to check whether the number is actually divisible by f or not

Answer for above test case is 6

1 Like

Thanks a lot for your time and helpâ€¦i got it now!

1 Like

please help me outâ€¦getting WA for the first set of test cases http://www.codechef.com/viewsolution/5230810