当前位置:网站首页>Leetcode 1952. Triple divisor
Leetcode 1952. Triple divisor
2022-06-11 10:31:00 【I'm not xiaohaiwa~~~~】

Give you an integer n . If n There are exactly three positive divisors , return true ; otherwise , return false .
If there are integers k , Satisfy n = k * m , So integers m Namely n One of the Divisor .
Example 1:
Input :n = 2
Output :false
explain :2 There are only two divisors :1 and 2 .
Example 2:
Input :n = 4
Output :true
explain :4 There are three divisors :1、2 and 4 .
Tips :
- 1 <= n <= 10^4
Code:
class Solution {
public:
bool isThree(int n) {
int res=0;
for(int i=1;i<=n;i++)
{
if((n%i)==0)
res++;
}
return res==3;
}
};
边栏推荐
- Circuit board made of real gold -- golden finger
- Correct opening method of RPC | understand go native net/rpc package
- [machine learning theory] true positive, true negative, false positive, false negative concept
- 用真金做的电路板——金手指
- Wuenda machine learning course - week 7
- Leetcode 1961. 检查字符串是否为数组前缀
- rpc的正确打开方式|读懂Go原生net/rpc包
- [Objective-C] dynamically create controls
- 本人书签常存的地址
- Installing mysql5.7 for Linux
猜你喜欢

安全相关网站推荐

MXNet对AlexNet模型的构建与实现(与LeNet的对比)

EMC rectification cases of electronic equipment radiation

Cas de rectification du CEM rayonné par des équipements électroniques

After four years of outsourcing, it was abandoned

IPhone 15 forced to use type-C interface

Kingbasees create database objects in batch

Internet of things security in the era of remote work

Fix the problem that uicollectionview does not reach the bottom security zone

用真金做的电路板——金手指
随机推荐
Pl/sql compilation check in kingbasees
Mysql--索引
Browserfetcher class for getting started with puppeter
利用PHP开发的一款万能、表白墙系统部分代码片段
金仓数据库KingbaseES UDP监控工具的使用
Cadence OrCAD capture design method to avoid misoperation graphic tutorial
Explain the physical layer consistency test of 2.5g/5g/10g Base-T Ethernet interface in detail!
详述用网络分析仪测量DC-DC和PDN
金仓数据KingbaseES 批量创建数据库对象
Mysql-- index
rpc的正确打开方式|读懂Go原生net/rpc包
Sys in kingbasees_ Checksums bad block detection function
【GAMES101】作业2--三角形光栅化
详解2.5G/5G/10G Base-T以太网接口物理层一致性测试!
Install MySQL version 5.7 or above on windows (install in compressed package)
Pyspark case series 4-dataframe output to a single folder solution
Leetcode 1952. 三除数
NGUI,聊天滚动框,UI TextList
Ugui mouse click diffusion UI effect
Differences between beanfactorypostprocessor and beanpostprocessor