atcoder#ARC104D. [ARC104D] Multiset Mean
[ARC104D] Multiset Mean
Score : points
Problem Statement
Given positive integers and , solve the following problem for every integer between and (inclusive):
- Find the number, modulo , of non-empty multisets containing between and (inclusive) instances of each of the integers such that the average of the elements is .
Constraints
- is prime.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Use the following format:
Here, should be the number, modulo , of multisets such that the average of the elements is .
3 1 998244353
1
3
1
Consider non-empty multisets containing between and instance(s) of each of the integers between and . Among them, there are:
- one multiset such that the average of the elements is : ;
- three multisets such that the average of the elements is : ;
- one multiset such that the average of the elements is : .
1 2 1000000007
2
Consider non-empty multisets containing between and instances of each of the integers between and . Among them, there are:
- two multisets such that the average of the elements is : .
10 8 861271909
8
602
81827
4054238
41331779
41331779
4054238
81827
602
8