Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ Modulo 10^9+7 (1000000007)

unsigned long long factorial(int n)
{
    const unsigned int M = 1000000007;
 
    unsigned long long f = 1;
    for (int i = 1; i <= n; i++)
        f = (f*i) % M;  // Now f never can
                        // exceed 10^9+7
    return f;
}
 
Comment

c Modulo 10^9+7 (1000000007)

unsigned long long factorial(int n)
{
    const unsigned int M = 1000000007;
 
    unsigned long long f = 1;
    for (int i = 1; i <= n; i++)
        f = (f*i) % M;  // Now f never can
                        // exceed 10^9+7
    return f;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: remove () not working c++ 
Cpp :: xmake set binary name 
Cpp :: delete specific vector element c++ 
Cpp :: std cout c++ 
Cpp :: c++ file to string 
Cpp :: qt label set text color 
Cpp :: cout char32_t c++ 
Cpp :: input a string in c++ 
Cpp :: how to return 2d array from function c++ 
Cpp :: Write C++ program to copy one string to another string using pointers 
Cpp :: convert string to stream c++ 
Cpp :: easy c++ code 
Cpp :: how to loop a 2 dimensional vector in c++ starting from second element 
Cpp :: map defualt value c++ 
Cpp :: how to get input in cpp 
Cpp :: c++ lcm 
Cpp :: apply pca to dataframe 
Cpp :: switch case with string c++ 
Cpp :: arduino buildin let 
Cpp :: syntax c++ 
Cpp :: use ::begin(WiFiClient, url) 
Cpp :: cpp convert vector to set 
Cpp :: arguments to a class instance c++ 
Cpp :: c++ add object to array 
Cpp :: how to create a min priority queue of pair of int, int 
Cpp :: c++ get type name 
Cpp :: convert string toupper and tolower in cpp 
Cpp :: on component begin overlap c++ 
Cpp :: check if a string is palindrome cpp 
Cpp :: clear qlayout 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =