Are the constraints such that all calcultions will fit in long long datatype or not???

It can be done with the available data types in C or C++

I think you should be able to figure out on your own if you really want to use integer datatypes, but in case you didnâ€™t notice, the output should be a real number.

1 Like

please explain the test case. I am not getting how come the answer be in fractions

While I am not allowed to explain the test cases I do believe I can safely point out that the question asks for an expected value. http://en.wikipedia.org/wiki/Expected_value