zoukankan      html  css  js  c++  java
  • 263. 丑数

    263. 丑数

    263. 丑数

    Table of Contents

    1 题目

    2 代码

    class Solution {
    
        /**
         * @param Integer $num
         * @return Boolean
         */
        function isUgly($num) {
        if ($num < 1) {
            return false;
        }
    
        while ($num % 2 == 0) {
            $num = floor($num / 2);
        }
        while ($num % 3 == 0) {
            $num = floor($num / 3);
        }
        while ($num % 5 == 0) {
            $num = floor($num / 5);
        }
        return $num == 1;
        }
    }
    

    3 思路

    • 如题,这是一个数学题

    ===

    作者: 吴丹阳 https://www.cnblogs.com/wudanyang

    更新时间: 2020-09-01 Tue 21:24

    Emacs 27.1 (Org mode 9.3.7)

    ===

    天行健,君子以自强不息。

    地势坤,君子以厚德载物。

    ===

  • 相关阅读:
    How many ways
    HDOj-1016 Prime Ring Problem
    DHU-1241 Oil Deposits
    Red and Black
    HDU-3790 最短路径问题
    vim/Gvim配置
    lintcode431- Connected Component in Undirected Graph- medium
    lintcode120- Word Ladder- medium
    lintcode531- Six Degrees- medium- microsoft
    lintcode624- Remove Substrings- medium
  • 原文地址:https://www.cnblogs.com/wudanyang/p/13598679.html
Copyright © 2011-2022 走看看