I must implement a problem that computes combinations and multisets of m elements from a set of n elements. The formulas for them are the following ones:
The problem is that with factorial it is easy to overflow, so basically what solutions can be for this problem?
Since it is a subproblem of a problem in TopCoder, I have following constraints:
1) A program must be written in C++.
2) I cannot load external libraries.