During solving this problem, when i submitted the following code with c++ setprecision function i got Wrong answer on test 5.
Code
And later the following one got accepted without setprecision.
Code
My question is, what i did wrong in the first one?
Thank You...
.
I can't see the actual wrong answer message so this is just guesses. It could be that when you're dividing by 2 in the first solution, ans is so large that floating point precision is too much of a problem (i.e. rounds it closer to .4 or .6 instead of .5)
got it. you are right. thanks