14791 - Combination Sum Problem   

Description

This program calculates the total number of ways to select at most m different items from n distinct items. To accomplish this, define a function that computes the binomial coefficient C(n,m), which represents the number of ways to choose m items from n. Then, compute the sum:

For reference, the binomial coefficient C(n,m) is defined as:

where n! = 1 x 2 x 3  x ... x n

 

Input

Two integers n and m,

where 0<n<15 and 0<m≤n.

Output

One integer — the total number of ways to select up to m items from n distinct items.

Ensure that the output, including formatting 輸出格式, exactly matches the provided samples.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss