Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
This program aims at calculating nCr modulo p. More...
#include <cassert>
#include <iostream>
#include <vector>
Classes | |
class | math::ncr_modulo_p::NCRModuloP |
Class which contains all methods required for calculating nCr mod p. More... | |
Namespaces | |
namespace | math |
for std::rand | |
namespace | ncr_modulo_p |
Functions for nCr modulo p implementation. | |
Functions | |
static void | tests (math::ncr_modulo_p::NCRModuloP ncrObj) |
Test implementations. More... | |
int | main () |
Main function. More... | |
This program aims at calculating nCr modulo p.
nCr is defined as n! / (r! * (n-r)!) where n! represents factorial of n. In many cases, the value of nCr is too large to fit in a 64 bit integer. Hence, in competitive programming, there are many problems or subproblems to compute nCr modulo p where p is a given number.
int main | ( | void | ) |
Main function.
|
static |
Test implementations.
ncrObj | object which contains the precomputed factorial values and ncr function |