Created
December 24, 2014 03:27
-
-
Save ssanin82/e8397d2c54cf7759d5a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef unsigned long long ULONG; | |
ULONG powm(ULONG a, ULONG n, ULONG mod) { | |
ULONG r = 1; | |
while (n) { | |
if (n & 1) { | |
r = (r * 1ll * a) % mod; | |
} | |
a = (a * 1ll * a) % mod; | |
n >>= 1; | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment