leetcode 263. 丑数
作者:互联网
class Solution {
public:
bool isUgly(int n) {
if(n <= 0) return false;
while(n % 2 == 0 || n % 3 == 0 || n % 5 == 0) {
if(n % 2 == 0) n /= 2;
if(n % 3 == 0) n /= 3;
if(n % 5 == 0) n /= 5;
}
return n == 1;
}
};
标签:丑数,return,int,Solution,class,263,leetcode 来源: https://blog.csdn.net/m0_37454852/article/details/115601114