Output problem

what does it means ?
Your answer will be considered correct if its absolute or relative error does not exceed 10^-6

1 Like

it means that your answer should be correct to 6 decimal places

1 Like

The statement means that if the difference between your answer and the correct answer is < (10 ^ -6), it will be considered as correct.

Eg:
Output is: 9.987654321
Your output is: 9.987654331

The answer will be evaluated as a correct answer and not a wrong answer, but if

The output is: 9.987654321
Your output is: 9.987645321

The answer will be evaluated as a wrong answer.

3 Likes

then what is a solution for this

1 Like

It means your answer is correct if either
difference is \le 10^{-6} or
difference/actual_answer \le 10^{-6}

PS :
absolute error = |your output-judge’s output|
relative error = |your output-judge’s output| /judge’s output

2 Likes

use double and set precision when you print output.

2 Likes

so why float or double give WA. And is there any possible solution for this when i am using double or float

1 Like

Your logic might be incorrect or you forgot to set precision when you print it.
Which language are you using ?

2 Likes

i used c++ . And i used set precision also

1 Like

yess might be my answer was not correct but thanks for clearing my doubt

1 Like

cout.precesion(20); (try making it 30 as well) at the start of your program

Try using this
If its still WA then probably your logic is incorrect.

2 Likes

i think logic is incorrect because half of test cases are not getting AC

1 Like