Contest - NSIT(Div 2) rated contest.
What is the need of “fixed” for printing the final answer in this question?
cout<<setprecision(10)<<1-rrc/(4*l); has not been passed.
cout<<fixed<<setprecision(10)<<1-rrc/(4*l); is passed.
Can anyone explain the importance of fixed?
Suppose your answer is 120
case 1:- you use fixed
answer will be printed as 120.000…(upto specified precision)
case 2:- you don’t use
answer will be printed as 120
Try the test case:
100000 1 100000 9999999
With “.6f”, it produces output:
Otherwise, it produces output:
Magnitude of error is greater than 1e-2.
Got your point, but both the output should give AC.
What was wrong with the judge then? @admin
@alpha_killer as @sarthakmanna explains, not using ‘fixed’ causes the output to be printed in scientific notation, which not all judges accept, or if accepted may be way off than the desired degree of accuracy.