Cube Summation
Time limit4sMemory limit512 MB
For each N, sum k^3 over all partitions of N with k parts, modulo 998244353, with up to 1e5 queries.
- Level
Medium7 of 10
- Topics
- Dynamic programming, Combinatorics, Math, Prefix sum
- Solved
- No attempts yet
Problem
Given an integer , consider all multi-sets of positive integers whose sum is .
For example, when , there are three possible multi-sets: , , and .
For each multi-set, compute the cube of its size, and output the sum of these values modulo .
Input
The first line of input contains an integer , the number of test cases ().
Each test case consists of a single line containing a single integer ().
Output
For each test case, output a single line with the answer to the problem.
Hint
In the first case, the only possible multi-set is . So the answer is .
In the second case, there are two possible multi-sets: and . So the answer is .
In the third case, there are three possible multi-sets: , , and . So the answer is .