Hello All, I was trying to do an old problem Problem Link where I got the wrong answer for a testcase while submitting the solution and I ran the same testcase on few other compilers, I got the correct answer. Here are the links to results from ideone, codeforces, geeksforgeeks and (unable to attach image) for the solution Solution Link .
Please help if anyone knows the reason.
You are rounding floating point values...
If answer is integer, so the double should be around an integer, then to get best rounding, use
int(ans+0.5);