From 2f92d790a8ae9816267098ea699aa9ec07005c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Renison?= <85908989+IvanRenison@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:34:11 -0300 Subject: [PATCH 1/2] Make multinomial shorter --- content/combinatorial/multinomial.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/combinatorial/multinomial.h b/content/combinatorial/multinomial.h index 99d397d7c..0e76ffda2 100644 --- a/content/combinatorial/multinomial.h +++ b/content/combinatorial/multinomial.h @@ -9,7 +9,6 @@ ll multinomial(vi& v) { ll c = 1, m = v.empty() ? 1 : v[0]; - rep(i,1,sz(v)) rep(j,0,v[i]) - c = c * ++m / (j+1); + rep(i,1,sz(v)) rep(j,0,v[i]) c *= ++m / (j+1); return c; } From 7e6a890d05cee91f22302cb00e76df350b6f984e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Renison?= <85908989+IvanRenison@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:27:36 -0300 Subject: [PATCH 2/2] Ups --- content/combinatorial/multinomial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/combinatorial/multinomial.h b/content/combinatorial/multinomial.h index 0e76ffda2..292522bb3 100644 --- a/content/combinatorial/multinomial.h +++ b/content/combinatorial/multinomial.h @@ -9,6 +9,6 @@ ll multinomial(vi& v) { ll c = 1, m = v.empty() ? 1 : v[0]; - rep(i,1,sz(v)) rep(j,0,v[i]) c *= ++m / (j+1); + rep(i,1,sz(v)) rep(j,0,v[i]) c = c * ++m / (j+1); return c; }