#P16044. [ICPC 2022 NAC] Double Sort
[ICPC 2022 NAC] Double Sort
题目描述
Given two integers and (), you generate a sequence of integers as follows:
- First, choose distinct integers between 1 and , inclusive.
- Sort these numbers in non-decreasing order.
- Take the difference sequence, which transforms a sequence into .
- Sort the difference sequence in non-decreasing order.
- Take the prefix sums of the sorted difference sequence to get the final sequence. This transforms a sequence into .
For example, with and :
- Suppose we initially chose .
- The sequence in order is .
- The difference sequence is .
- The sorted difference sequence is
- The prefix sums of the sorted difference sequence are .
Suppose you chose a uniformly random set of distinct integers for step 1. Compute the expected value for each index in the final sequence.
输入格式
The single line of input contains two integers () and (), where is the size of the sequence, and all of the initial integers chosen are in the range from 1 to .
输出格式
Output lines. Each line contains a single real number, which is the expected value at that index of the final sequence. Each answer is accepted with absolute or relative error at most .
3 5
1
2.3
4.5