I stored all the bits of all numbers in a 2d-array. Then I proceeded bit by bit, finding the total probability of number of 1’s being taken into to be odd (because then the net xor would be 1, else it would be zero). Finally I summed all probabilities multiplied by 2^bit. Any mistakes in my approach or code would be very helpful…Thanks in advance.
CodeChef: Practical coding for everyone → Link to my WA solution
Try cout << fixed << setprecision(7)
instead of simply cout << setprecision(7)
Did not work.
Can you just help me with some testcases ?
I put in some of my own (random numbers) and it matched the answer with AC solutions:cry:
The logic seems right, I think it’s a precision issue. Along with the fixed
, change all variable types from float
to double
1 Like
It worked…Thanks bro! Would’ve been good if I noticed during the challenge …