From 63a38d41b3c2b50429d4af7b3cdffdcdd915e3b7 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Thu, 23 Feb 2023 18:16:53 +0100 Subject: added more ctalan stuff --- math/binomial3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'math/binomial3.cpp') diff --git a/math/binomial3.cpp b/math/binomial3.cpp index 760f2eb..f52337c 100644 --- a/math/binomial3.cpp +++ b/math/binomial3.cpp @@ -1,5 +1,6 @@ ll calc_binom(ll n, ll k, ll p) { - if (n >= p || k > n) return 0; + assert(n < p) //wichtig: sonst falsch! + if (k > n) return 0; ll x = k % 2 != 0 ? p-1 : 1; for (ll c = p-1; c > n; c--) { x *= c - k; x %= p; -- cgit v1.2.3