F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Expectation

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 147    Accepted Submission(s): 83


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.
 

Sample Input
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
 

Sample Output
1 332748122 969129126
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 11:47:29, Gzip enabled