Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fast_pow(a, n):
- if n < 0:
- return 1 / fast_pow(a, -n)
- if n == 0:
- return 1
- if n % 2:
- return a * fast_pow(a, n - 1)
- else:
- return fast_pow(a * a, n / 2)
- a = float(input())
- n = int(input())
- print(fast_pow(a, n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement