Functions
Function-25
Function-26
Function-27
~/algor $ cat problems/funksiya-kombinatsiyalar-soni
Number of combinations
Easy
1000 ms
128 MB
27%
Write a function Combinations(n, k) that returns the number of ways to choose $k$ items out of $n$:
$$C_{n}^{k} = \frac{n!}{k! * (n - k)!}$$
Here $0! = 1$.
Example 1: Combinations(5, 2) → 10
Example 2: Combinations(6, 3) → 20
Write only the function body.
Input
One line with two non-negative integers $n$ and $k$ — the arguments of the function.
Output
The value returned by the function: an integer.
Note
$0 \le n \le 50$
$0 \le k \le 50$
$k \le n$
Examples
Input #1
5 2
Output #1
10
Input #2
6 3
Output #2
20