#K57042. Count Gemstone Subsets
Count Gemstone Subsets
Count Gemstone Subsets
Given n types of gemstones, your task is to count the number of ways to select exactly k types. This is equivalent to calculating the binomial coefficient ( \binom{n}{k} ). Note that by definition, ( \binom{n}{0} = 1 ) and if ( k > n ), then ( \binom{n}{k} = 0 ).
For example, if n = 5 and k = 3, the answer is 10.
inputFormat
Input is read from standard input (stdin) and consists of a single line containing two integers n and k separated by a space.
outputFormat
Output to standard output (stdout) a single integer representing the number of subsets of exactly k gemstones from n types.## sample
5 3
10
</p>