Website Summary Files Commits Branches @commit @diff @stats
path: root / Week13 / Exercise19.cpp
blob: a0d5ace8388277ae9ded26024e5ec58737c45a3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

unsigned binom(unsigned n, unsigned k) {
	if (k == 0 || n == k)
		return 1;
	return binom(n - 1, k - 1) + binom(n - 1, k);
}

int main() {
	unsigned n, k;
	std::cin >> n >> k;

	std::cout << binom(n, k) << std::endl;

	return 0;
}