summaryrefslogtreecommitdiff
path: root/math/binomial3.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2023-02-23 18:16:53 +0100
committermzuenni <michi.zuendorf@gmail.com>2023-02-23 18:16:53 +0100
commit63a38d41b3c2b50429d4af7b3cdffdcdd915e3b7 (patch)
treed0b22cd723643d401ae91812f33cebb37a7e7e72 /math/binomial3.cpp
parentb40b4fbc8222226608c64013e56226044884374e (diff)
added more ctalan stuff
Diffstat (limited to 'math/binomial3.cpp')
-rw-r--r--math/binomial3.cpp3
1 files changed, 2 insertions, 1 deletions
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;