More Generating Functions
Today we take a look at the problem ABC241 H. We are given $N \le 16$ distinct numbers $A_1, \cdots, A_N$ and a sequence describing the amount of supply of each number: a sequence $B_1, \cdots, B_N$ where $B_i$ refers to the supply of the number $A_i$. The score of a combination of $M$ chosen numbers is the product of the numbers. That is, suppose we pick $C_i$ occurences of the $A_i$ where $0 \le C_i \le B_i$ and $\sum C_i = M$, then $\text{score}(C) = \prod_{i = 1}^{N} A_i^{C_i}$. The objective is to find the sum of scores over all possible valid combinations. ...