P29807 [洛谷] "PMOI-5" Component Forces
提高+
题目描述

Problem Description

In a Cartesian coordinate plane, there is a circle with a radius of $1$ and its center at $(0,0)$.

This circle has $n$ red points marked equidistantly on it, with one point located on the positive $x$-axis.

NaCly_Fish stands at $(0,0)$ and randomly pushes towards one of the red points with a force of $1 \text{ N}$.

Let the components of her push force on the $x$ and $y$ axes be $F_x$ and $F_y$, respectively. She wants to know the $k$-th central moment of these two random variables.

For a random variable $x$, its $k$-th central moment is defined as $E((x-E(x))^k)$, where $E(x)$ is the expected value of $x$.

It can be proven that the answer is always a rational number, so the answer should be taken modulo $998244353$.

Input Format

The input consists of a single line with two positive integers $n$ and $k$.

Output Format

Output a single line with two integers, representing the $k$-th central moment of $F_x$ and $F_y$, respectively.

Sample Input and Output

Sample Input #1

2 2

Sample Output #1

1 0

Sample Input #2

5 15

Sample Output #2

815216641 0

Sample Input #3

114 514

Sample Output #3

636199406 569855248

Notes

Sample Explanation for Sample #1:
The second central moment is the variance. Since the push can only be in the positive or negative $x$ direction, $F_y$ is always zero, and thus its variance is zero; $F_x$ can be $\pm 1$ with equal probability, so its variance is $1$.

Data Range:

This problem uses batched testing.

  • Subtask 1 (7 pts): $2\le n,k \le 20$;
  • Subtask 2 (14 pts): $2\le n \le 100$;
  • Subtask 3 (19 pts): $2\le n \le 10^3$;
  • Subtask 4 (23 pts): $2\le k \le 10^7$;
  • Subtask 5 (37 pts): No special restrictions.

For $100\%$ of the data, $2\le n \le 3 \times 10^4$, $2\le k \le 10^9$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2
样例输出
1 0