Help me debug this code.

https://www.codechef.com/problems/FUNC

I have been trying to solve this problem, but my code gives wrong answer. I have matched all the corner cases with an accepted solution, and my code gives same output with the accepted code. Help me debug my code.

This is my code :

https://www.codechef.com/viewsolution/12359258

I didn’t debug it, but you’re using pow function… remember about approximations as ans returned could be 23.999999 or 24.0000001 instead of 24 which could mess with your logic. You have to set tolerance limits for rounding such cases.

I think @satannitr is right.

@satannitr, I have used EPS of 0.5 to avoid this error.

//