Problem 2978 --Everything Is Generated In Equal Probability

2978: Everything Is Generated In Equal Probability

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
One day, Y_UME got an integer NN and an interesting program which is shown below: 



Y_UME wants to play with this program. Firstly, he randomly generates an integer n∈[1,N]n∈[1,N] in equal probability. And then he randomly generates a permutation of length nn in equal probability. Afterwards, he runs the interesting program(function calculate()) with this permutation as a parameter and then gets a returning value. Please output the expectation of this value modulo 998244353998244353

A permutation of length nn is an array of length nn consisting of integers only ∈[1,n]∈[1,n] which are pairwise different. 

An inversion pair in a permutation pp is a pair of indices (i,j)(i,j) such that i>ji>j and pi<pjpi<pj. For example, a permutation [4,1,3,2][4,1,3,2] contains 44inversions: (2,1),(3,1),(4,1),(4,3)(2,1),(3,1),(4,1),(4,3)

In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. Note that empty subsequence is also a subsequence of original sequence. 

Refer tohttps://en.wikipedia.org/wiki/Subsequence for better understanding.
There are multiple test cases. 

Each case starts with a line containing one integer N(1≤N≤3000)N(1≤N≤3000)

It is guaranteed that the sum of NNs in all test cases is no larger than 5×1045×104.
For each test case, output one line containing an integer denoting the answer.
1
2
3
0
332748118
554580197

推荐代码 查看2978 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$46 $ms] 淡意的温柔 605355 2020-07-03 15:19:06
内存最少[$1808 $KB] 淡意的温柔 605355 2020-07-03 15:19:06
第一AC 淡意的温柔 605355 2020-07-03 15:19:06
第一挑战 淡意的温柔 605355 2020-07-03 15:19:06

赛题来源/所属竞赛 2019 Multi-University Training Contest 2 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛