I am getting WA for this problem. Its a pretty straight forward problem of counting total subarrays with sum <= K.
Here is my solution.
P.S- I used this precision function, as setprecision(8) was not giving me only 1 AC in first subtask.
Can anyone provide some counter test cases.
Edit- I just printed the result without precision and got AC. Why was it giving wrong answer when I used setprecision, which I think should give correct decimal places.
1 Like
@ssjgz can you please help as to why does it give AC without using precision and WA using setprecision. AC submission
check this you should found your mistakes
Thanks for this. I have already got AC. It’s just that, I get WA when I use setprecision(8)
and AC when I just print the result. The problem exclusively says
Output one number P to a maximum of 8 decimal places,
So, I think using setprecision should give correct answer.
1 Like
They asked “Output one number P to a maximum of 8 decimal places”. Not exactly 8.
1 Like
The thing is that what answer has the problem setter uploaded . Many a times in question involoving decimal digits you will see error approximation that is for precision . May be the setter for this problem didn’t mentioned any Error range so you had to give exact answer as the setter , and since setter would have usey only double without precision so it was giving WA.
3 Likes
It would be much easier if the actual count was asked instead of probability. It just makes us spend time on useless things.
1 Like
True… there was no checker involved (at least I believe so). So, you got a WA.
1 Like