Created
June 7, 2016 12:36
-
-
Save kemingy/c62c9a0d5eef8905781a08716f330ced 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
| long long quick_pow(int e, int n) | |
| { | |
| long long ans = 1, tmp = e; | |
| if(!e) | |
| { | |
| return 0; | |
| } | |
| while(n > 0) | |
| { | |
| if (n & 1 == 1) | |
| { | |
| ans *= tmp; | |
| } | |
| tmp = tmp * tmp; | |
| n = n >> 1; | |
| } | |
| return ans; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment