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

Matrix

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 361    Accepted Submission(s): 112


Problem Description
Fill an $n\times n$ matrix with numbers in $[1,n^2]$, where each number occurs exactly once.

For a fixed number filling method, let $a_i$ be the mininum number in the $i$th row, and $S=\{a_1,a_2,...,a_n\}\cap\{1,2,...,n\}$.

You need to calculate $\sum |S|\pmod {998244353}$, i.e. the sum of the size of $S$ over all possible methods.
 

Input
This problem contains multiple test cases.

The first line contains a single integer $T$ ($1 \leq T \leq 30$).

Then $T$ cases follow, each of which contains a single interger $n$ ($1\leq n\leq 5000$).
 

Output
For each test case, output one line contains the value of $\sum |S|\pmod {998244353}$.
 

Sample Input
1 2
 

Sample Output
40
 

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 07:09:07, Gzip enabled