Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Modulo Exponentiaon,Iteratve Modulo Exponentiation,Binary Exponentiation

long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
Source by cp-algorithms.com #
 
PREVIOUS NEXT
Tagged: #Modulo #Modulo #Exponentiation
ADD COMMENT
Topic
Name
6+5 =