Why this code for Gold Mining is failing

This is my submission to Gold Mining problem :

It is similar to most of accepted solutions, only difference is that I didn’t use set precision most of them fixed their answer to 6 decimal places and it got accepted.

one such code: https://www.codechef.com/viewsolution/34815950

As stated in the question , you have to print up to 6 decimal places which i dont think you are doing
for doing it add this before outputting the answer and u will get correct answer :


Thanks for your response, In question they didn’t mention that we have to print upto six decimal places but they did mention that relative error should be less than 10^-6.

I got answer from another discussion that my code prints values in scientific values as i am using cout so it might fail there. But still i have a doubt that how the judge is evaluating solution. Do they take outputs as real numbers or strings ?. If they take it as real numbers I guess my solution doesn’t fail , If they take it as strings then it fails but if they take it as strings then they should have mentioned in question to print upto six decimal places. ( I don’t know if this is standard way to mention things, I didn’t participate in lot of contests)

Also I saw in other discussion that it is not exact logic to solve question. So no worries.