Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int binpow (int a, int n) {
- int res = 1;
- while (n)
- if (n & 1) {
- res *= a;
- --n;
- }
- else {
- a *= a;
- n >>= 1;
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement