class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n==0:
return 1.0
if n==1:
return x
if n<0:
x=1.0/x
return self.myPow(x,-n)
v = self.myPow(x,n/2)
return v*v*self.myPow(x,n-(n/2)*2)