There are n distinct integers. a1, a2, ..., an (1 <= n <= 1e5) a1 < a2 < ... < an (1 <= ai <= 1e5) And there is an integer k (k <= 1e5) I will choose n integers. b1, b2, ..., bn, ai <= bi <= k for i = 1, 2, ..., n For each choosing method, there is a product, the product of the factorial of each number's occurence. I want to calculate the sum of these products.
For example:
n == 3
k == 4
[1, 3, 4]
Then, the answer is 18.
I don't know how to solve it.
Seems very hard. Where is this from?
A problem from CCPC.
me too. alas, difficulty is necessary as it strengthens our skills.