LintCode:Ugly Number
2016-04-25 20:49
381 查看
LintCode:Ugly Number
class Solution: # @param {int} num an integer # @return {boolean} true if num is an ugly number or false def isUgly(self, num): # Write your code here if num == 0: return False while num != 2 or num != 3 or num != 5: if num % 2 == 0: num /= 2 elif num % 3 == 0: num /= 3 elif num %5 == 0: num /= 5 else: break if num == 1: return True return False
相关文章推荐
- POJ_3280_Cheapest_Palindrome_(动态规划)
- 二叉树学习随笔
- Hadoop学习(三)— hdfs : NameNode与DataNode的实现机制
- hdu_1037_今年暑假不AC
- 哈希映射
- Android开发踩过的坑(一)
- C++ try catch 用法
- redis将对象序列化存储
- php发送email最终版
- Android调用WebService详解
- emacs24 配置c++ 开发环境
- CSS清除浮动大全共8种方法
- 代码之髓
- 0041 linux 下配置安装mysql以及配置
- SetupFactory打包要点集合
- 用户认证
- poj 1661 Help Jimmy(DP)
- beamer使用之ppt中插入四张图像,及中文
- Jenkins插件开发(2):开发新插件
- jQuery comet