【leetcode❤python】326. Power of Three

#-*- coding: UTF-8 -*-
class Solution(object):
    def isPowerOfThree(self, n):
        if n<=0:
            return False
        while True:
            if n==3 or n==1:
                return True
            tuple=divmod(n,3)
            if tuple[1]!=0:
                return False
            n=tuple[0]
            
sol=Solution()
print sol.isPowerOfThree(333)

上一篇:(1)RGB-D SLAM系列- 工具篇(硬件+关键技术)


下一篇:IfcFlowDirectionEnum