class Solution(object):
def isUgly(self, num):
if num<=0:return False
comlist=[2,3,5];modflag=0
while True:
if num==1:break
for value in comlist:
tuple=divmod(num,value)
if tuple[1]==0:
modflag=1;num=tuple[0]
break
if modflag==0:return False
modflag=0
return True
sol=Solution()
print sol.isUgly(1)
相关文章
- 12-17【LeetCode】375. Guess Number Higher or Lower II 解题报告(Python)
- 12-17[LeetCode] 263. Ugly Number
- 12-17263. Ugly Number
- 12-17[LeetCode]题解(python):136-Single Number
- 12-17Python3解leetcode Single Number
- 12-17leetcode 263. Ugly Number 、264. Ugly Number II 、313. Super Ugly Number 、204. Count Primes
- 12-17Leetcode之动态规划(DP)专题-264. 丑数 II(Ugly Number II)
- 12-17leetcode@ [263/264] Ugly Numbers & Ugly Number II
- 12-17【LeetCode】137. Single Number II 解题报告(Python)
- 12-17LeetCode313. Super Ugly Number