#K54157. Card Combination Sum
Card Combination Sum
Card Combination Sum
You are given a deck of cards numbered from 1 to N. Your task is to determine the number of ways to pick exactly X cards such that the sum of the selected cards is exactly S. Each card can be chosen at most once, and the order of selection does not matter.
The answer can be very large, so you should output it modulo \(10^9+7\).
Constraints:
- 1 \(\leq N \leq\) some reasonable upper bound
- 0 \(\leq X \leq N\)
- \(S \geq 0\)
Example:
Input: 5 2 5 Output: 2
inputFormat
The input consists of a single line containing three space-separated integers: N, X, and S, where
- N is the number of cards in the deck, numbered from 1 to N.
- X is the number of cards to choose.
- S is the target sum for the chosen cards.
outputFormat
Output a single integer: the number of ways to select X cards from the deck such that their sum is S, modulo \(10^9+7\).
## sample5 2 5
2