#P6298. 齿轮
齿轮
Description
Daniel13265 somehow found gears. The number of teeth on the -th gear is a positive integer not exceeding . He now wants to connect (assemble) of these gears together in some way.
After gears are used for a period of time, wear will occur. The wear rate of a gear set is determined by the greatest common divisor of the numbers of teeth of all gears in the set: the larger the greatest common divisor is, the more often the same teeth mesh with each other, and thus the faster the wear rate becomes. This greatest common divisor is also called the wear factor.
It is easy to compute the wear factor of a given gear set. However, Daniel13265 now wants to know the wear factors of all possible gear sets that can be assembled.
Daniel13265 knows that it is impossible to assemble a gear set with a wear factor greater than . Also, since the number of possible gear sets can be very large, you only need to tell him the following instead: for every , output the number of gear sets that can be assembled whose wear factor is , modulo .
Input Format
The input has lines.
The first line contains three positive integers , representing the number of gears Daniel13265 has, the maximum possible number of teeth on a gear, and the desired number of gears in the gear set.
The second line contains positive integers separated by single spaces. The -th number denotes the number of teeth on the -th gear.
Output Format
Output one line with integers. The -th integer denotes the number of gear sets that can be assembled whose wear factor is , modulo .
5 6 2
1 2 3 4 6
6 3 1 0 0 0
Hint
Sample Explanation
There are gear sets with wear factor : .
There are gear sets with wear factor : .
There is gear set with wear factor : .
Constraints
This problem uses bundled testdata. If you pass all test cases in a subtask, you will get the full score for that subtask.
| Subtask ID | Score | |||
|---|---|---|---|---|
For of the testdata, and .
Translated by ChatGPT 5
京公网安备 11011102002149号