mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-19 22:52:23 +03:00
inverse Modulo
This commit is contained in:
9
Number Theory/inverse_factorial.cpp
Normal file
9
Number Theory/inverse_factorial.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
int invFac[MAX_N];
|
||||||
|
void inverse_factorial(){
|
||||||
|
|
||||||
|
invFac[0] = invFac[1] = 1;
|
||||||
|
|
||||||
|
for(int i = 2 ; i <= MAX_N ; i++ ){
|
||||||
|
invFac[i] = (inverse(i)*invFac[i-1])%M;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user