summaryrefslogtreecommitdiff
path: root/content/math/binomial1.cpp
blob: dab20b373feac40de9b140c688867381940c3b59 (plain)
1
2
3
4
5
6
7
8
ll calc_binom(ll n, ll k) {
	if (k > n) return 0;
	ll r = 1;
	for (ll d = 1; d <= k; d++) {// Reihenfolge => Teilbarkeit
		r *= n--, r /= d;
	}
	return r;
}