Natural Number Sums
Time limit1sMemory limit1024 MB
Count sets of distinct integers from 1 to N, none a multiple of K, with an even number of elements that sum to N, modulo 998244353.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Math
- Solved
- No attempts yet
문제
Two integers and are given. Find the number of sets that satisfy all of the following conditions, modulo .
- Every element of is a distinct positive integer at most that is not a multiple of .
- is even.
- The sum of all elements of is .
입력
The first line contains the number of test cases .
Each test case is given on one line with two integers and .
출력
For each test case, print the answer on its own line.