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)