Expectation

TimeLimit:5000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Notice:Don't output extra spaces at the end of one line.

There are $(2n+1)$ distinct positions on the number line, $x_1,x_2,....x_{2n+1}$ in the strictly increasing order. each position with odd index is a hole and each postition with even index is a ball.

Koishi will play a game consisting of $n$ rounds, in each round:

1.Koishi selects a ball that isn't in holes at random.

2.then select the direction,left or right at random.

3.then the chosen ball starts rolling in that chosen direction, until it falls into an empty hole(the hole with no ball falling into it before)

Koishi is interested in the sum of distances of balls rolling. What is the expected value of the sum? modulo $998244353$
Input
First line contains an integer $T(1\leq T\leq 2000)$, number of test cases.

In each test cases, the first line contains an integer $n(1\leq n\leq 3000)$. The second line contains $(2n+1)$ integers in a single line representing $x_1,x_2,...x_{2n+1}$

$-10^9\leq x_1<x_2,...,<x_{2n+1}\leq 10^9$
Output
$T$ lines, each with a non-negative integer representing the answer.
SampleInput
3
1
1 2 3
3
1 2 3 4 5 6 7
10
0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210
SampleOutput
1
332748122
969129126
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: