Search
 
SCRIPT & CODE EXAMPLE
 

CPP

binary exponentiation modulo m

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: Matrix multiply using function c++ 
Cpp :: c++ triangle 
Cpp :: c++ vector element search 
Cpp :: cout was not declared in this scope 
Cpp :: locate specific string letters c++ 
Cpp :: how to sort a vector in descending order in c++ 
Cpp :: remove at index vector c++ 
Cpp :: binary string addition 
Cpp :: c++ program to calculate discount 
Cpp :: c++ random 
Cpp :: c++ char array to int 
Cpp :: c++ int to string 
Cpp :: how to read wav file in C++ 
Cpp :: c++ check if string is empty 
Cpp :: how to convert int to string c++ 
Cpp :: string reversal 
Cpp :: 2d vector cpp 
Cpp :: C++ switch cases 
Cpp :: c++ hide show console 
Cpp :: convert all characters in string to uppercase c++ 
Cpp :: c++ length of char array 
Cpp :: footnote appears in the middle latex 
Cpp :: C++ string initialization 
Cpp :: sleep c++ 
Cpp :: how to easily trim a str in c++ 
Cpp :: delete specific row from dynamic 2d array c++ 
Cpp :: Quicksort taking random pivot 
Cpp :: debugging c/c++ with visual studio code 
Cpp :: c++ array rev pointer 
Cpp :: how to remove a index from a string in cpp 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =