Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fast_pow(x, p):
- res = 1
- while p > 0:
- if p % 2 == 1:
- res = res * x
- x = x * x
- p //= 2
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement