#P1943. Local Maxima
Local Maxima
Description
Given a permutation. If an element is larger than all the elements before it, it is called a "Local Maxima".
Now, in a randomly generated permutation of length , find the expected number of elements that are "Local Maxima".
Input Format
A single line containing a positive integer .
Output Format
Output a single real number representing the answer, rounded to eight decimal places.
2
1.50000000
Hint
There are permutations of length : and . In the former, both numbers are "Local Maxima"; in the latter, only the first number is a "Local Maxima".
Constraints
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号