zoukankan      html  css  js  c++  java
  • 【leetcode❤python】263. Ugly Number

    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)

  • 相关阅读:
    make menuconfig出现乱码
    内存中的变量和值
    is&==
    python小整数池
    生成器
    GIL
    grub rescue问题修复
    期末考试
    期末要求
    选课练习
  • 原文地址:https://www.cnblogs.com/kwangeline/p/5953622.html
Copyright © 2011-2022 走看看