a^b-b^a
Problem Description
You are given natural numbers a and b. Find a^b-b^a.
Input
Input contains numbers a and b (1≤a,b≤100).
Output
Write answer to output.
Sample Input
2 3
Sample Output
-1
Solution
代码语言:javascript复制if __name__ == '__main__':
x, y = map(int, input().split())
def quick_pow(a, n):
res = 1
while n != 0:
if n & 1:
res *= a
a *= a
n >>= 1
return res
print(quick_pow(x, y) - quick_pow(y, x))