You roll n independent fair dice, each with faces numbered 1 to m. Let X be the largest value shown. Compute the expected value E[X].
Two integers n and m.
Output E[X] with absolute or relative error at most 1e-6.
1 <= n <= 10^9
2 <= m <= 10^5
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
Numeric answers are accepted if they are within an absolute tolerance of 1e-06 or a relative tolerance of 1e-06 of the expected value.
1 6
3.500000000
2 6
4.472222222