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

Everything Is Generated In Equal Probability

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 1070    Accepted Submission(s): 756


Problem Description
One day, Y_UME got an integer $N$ and an interesting program which is shown below:



Y_UME wants to play with this program. Firstly, he randomly generates an integer $n \in [1, N]$ in equal probability. And then he randomly generates a permutation of length $n$ 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 $998244353$.

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

An inversion pair in a permutation $p$ is a pair of indices $(i, j)$ such that $i > j$ and $p_i < p_j$. For example, a permutation $[4, 1, 3, 2]$ contains $4$ inversions: $(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 to https://en.wikipedia.org/wiki/Subsequence for better understanding.
 

Input
There are multiple test cases.

Each case starts with a line containing one integer $N(1 \leq N \leq 3000)$.

It is guaranteed that the sum of $N$s in all test cases is no larger than $5 \times 10^4$.
 

Output
For each test case, output one line containing an integer denoting the answer.
 

Sample Input
1 2 3
 

Sample Output
0 332748118 554580197
 

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-21 21:30:46, Gzip enabled