Easy Math Problem

TimeLimit:5000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
You need to calculate $\sum\limits_{i=1}^n\sum\limits_{j=1}^n{\tbinom{i + j}{i} \cdot f(i + j, i)}$, where $f(0, x) = 0, f(1, x) = a,$ and for all $2 \leq m \leq x$, $f(m, x) = b \cdot f(m - 1, x) + c \cdot f(m - 2, x)$, and moreover, for all $m > x$, $f(m, x) = d \cdot f(m - 1, x) + e \cdot f(m - 2, x)$.

In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers $n \geq k \geq 0$ and is written $\tbinom {n}{k}$. It is the coefficient of the $x^k$ term in the polynomial expansion of the binomial power $(1 + x)^n$, and is given by the formula

$$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$
Input
This problem contains multiple test cases.

The first line contains an integer $T(1 \leq T \leq 50)$ indicating the number of test cases.

The next $T$ lines each contains six integers $n, a, b, c, d, e(1 \leq n \leq 10 ^ 5, 1 \leq a, b, c, d, e \leq 10 ^ 6)$.
Output
Output $T$ lines, each line contains an integer indicating the answer.

Since the answer can be very large, you only need to output the answer modulo $998244353$.
SampleInput
2
3 1 1 1 1 1
2 1 2 3 4 5
SampleOutput
316
482
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: