当前位置:网站首页>Leetcode 263. ugly number
Leetcode 263. ugly number
2022-07-26 13:11:00 【PUdd】
LeetCode 263. Ugly number
Their thinking
Respectively for 2,3,5 Doing modular operations ;
This problem can also be iterated 、 Hand it over and do it
C++ Code
class Solution {
public:
bool isUgly(int n) {
if (n!=0)
{
while( n%2 == 0 ) n/=2;
while( n%3 == 0 ) n/=3;
while( n%5 == 0 ) n/=5;
if (n!=1) return 0;
else return 1;
}
return 0;
}
};
边栏推荐
- Learn about Pinia state getters actions plugins
- Commonly used list Why does isempty() suddenly report null?
- MySQL可以自定义变参存储函数吗?
- 基于Bézier曲线的三维造型与渲染
- V00 - do whatever you want when you are old
- 父组件访问子组件的方法或参数 (子组件暴漏出方法defineExpose)
- JSON format execution plan (6) - MySQL execution plan (52)
- Where is safe to open an account when buying stocks on mobile phones?
- Transactional transaction propagation behavior?
- Kubernetes----高级存储之PV和PVC简介
猜你喜欢
![[typescript] typescript common types (Part 1)](/img/80/5c8c51b92d3a9d76f38beba7be0aa6.png)
[typescript] typescript common types (Part 1)

Elementary notes of binary tree

【5GC】什么是5G切片?5G切片如何工作?

New function | intelligent open search online customized word weight model

From January to June, China's ADAS suppliers accounted for 9%, and another parts giant comprehensively laid out the new smart drive track

Kubernetes Flannel:HOST-GW模式

0 basic programming resources (collect first ~ read slowly ~)

Today in history: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone

概率论与数理统计

Version of NDK matched the requested version 21.0.6113669. versions available locally: 2
随机推荐
Flutter dart generates a list of random numbers that are not repeated in n intervals
LeetCode 69. x 的平方根
Food safety | what food can be heated in a microwave oven? You should know these potential safety hazards
Student examination system based on C #
Solution: unable to load the file c:\users\user\appdata\roaming\npm\npx PS1, because running scripts is prohibited on this system.
MySQL data directory (3) -- table data structure MyISAM (XXVI)
0 basic programming resources (collect first ~ read slowly ~)
JVM: what does the class loading subsystem do? What is it made of? What eight part essay do you need to remember?
Create EOS account action
Who is responsible for the problems of virtual idol endorsement products? And listen to the lawyer's analysis
LeetCode 1523. 在区间范围内统计奇数数目
Shutter background graying effect, how transparency, gray mask
Kubernetes -- Introduction to common plug-ins of kubernetes
关于自动重复调用接口的一种实现方式-反射
Bitwise and how to write SQL
Niuke brush sql---2
学习pinia 介绍-State-Getters-Actions-Plugins
Kubernetes ---- life cycle introduction of PV and PVC
B+树索引使用(9)分组、回表、覆盖索引(二十一)
C regards type as generic type T and uses it as generic type of method