P28013 [洛谷] Stuttering
提高+
题目描述

Background

The formal problem statement is provided at the end of the description.

Problem Description

Due to practicing rap, ZHY has developed a stutter.

ZHY's stutter is quite unique. Specifically, if ZHY is to read a passage with $n$ characters, he will read the first character once, the second character twice, the third character three times, and so on, until the $n$-th character which he will read $n$ times. For example, if the phrase is "Genshin Impact," ZHY would read it as "Genshin Impactctct."

YHZ has $n$ characters, each with a pleasantness value $a_i$ assigned by YHZ, and $a_{1 \sim n}$ forms a permutation of $1 \sim n$. Now, YHZ wants to rearrange these $n$ characters into a passage for ZHY to read. Since YHZ enjoys playing Genshin Impact, he requires that the number of inversions in the rearranged sequence $a$ be exactly $k$. However, YHZ has not yet decided on the order of each character, so please calculate the sum of the pleasantness values of all characters that YHZ will hear after ZHY reads the passage in order, for all possible permutations. Obviously, if YHZ hears a character multiple times, its pleasantness value should be counted multiple times into the total sum.

Formal Problem Statement

A permutation $a_1, a_2, \cdots, a_n$ of $1 \sim n$ is considered valid if and only if its number of inversions is exactly $k$. Additionally, for a permutation $a_1, a_2, \cdots, a_n$, its weight is $\sum_{i=1}^n i \times a_i$.

Given $n$ and $k$, please calculate the sum of the weights of all valid permutations of $1 \sim n$, modulo $998244353$.

The number of inversions in a permutation is defined as $\sum_{i=1}^n \sum_{j=i+1}^n [a_i > a_j]$.

Input Format

A single line containing two integers $n, k$.

Output Format

A single integer representing the answer modulo $998244353$.

Sample Input and Output

Sample Input #1

3 2

Sample Output #1

22

Sample Input #2

7 5

Sample Output #2

22066

Notes

Sample 1 Explanation

The only valid permutations are $2 \ 3 \ 1$ and $3 \ 1 \ 2$, both of which have a weight of $11$, so the answer is $22$.


For $10\%$ of the data, $n \le 10$.

For $25\%$ of the data, $n \le 100$.

For another $20\%$ of the data, $k \le 300$.

For $100\%$ of the data, $1 \le n \le 300$, $0 \le k \le \frac{n(n-1)}{2}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2
样例输出
22