当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6821:Set2

题目描述
You are given a set $S=\{1..n\}$. You have to do the following operations until there are no more than $k$ elements left in the $S$:

Firstly, delete the smallest element of $S$, and then randomly delete another $k$ elements one by one from the elements left in $S$ in equal probability.

Note that the order of another deleted $k$ elements matters. That is to say, you delete $p$ after $q$ or delete $q$ after $p$, which are different ways.

For each $i \in [1,n]$, determine the probability of $i$ being left in the $S$.

It can be shown that the answers can be represented by $\frac{P}{Q}$, where $P$ and $Q$ are coprime integers, and print the value of $P \times Q^{-1} \ mod $ $\space 998244353$.
输入解释
The first line contains the only integer $T(T \in [1,40])$ denoting the number of test cases.

For each test case:

The first line contains two integers $n$ and $k$.

It guarantees that: $n \in [1,5000] ,\ \sum n \in [1,3 \times 10^4],\ k \in [1,5000].$
输出解释
For each test case, you should output $n$ integers, the $i$-th of them means the probability of $i$ being left in the $S$.
输入样例
1
5 2
输出样例
0 499122177 499122177 499122177 499122177
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6821

最后修改于 2020-10-25T23:34:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 524288/524288K(Java/Others)