当前位置:网站首页>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;
}
};
边栏推荐
- Differences between beanfactorypostprocessor and beanpostprocessor
- Ngui, map zoom in and out
- MOSFET的SOA或者ASO是什么?
- Arbitrum infrastructure: a quick start
- Batch add noise to data and generate new named annotation files
- Fix the problem that uicollectionview does not reach the bottom security zone
- NGUI,选择性别男女
- iPhone 15 被迫用上 Type-C 接口
- 硬件描述语言HDL
- 金仓数据库KingbaseES中的sys_checksums坏块检测功能
猜你喜欢

TikTok在英国遭遇文化冲突,短期内众多员工离职

Pyspark case series 4-dataframe output to a single folder solution

Install MySQL version 5.7 or above on windows (install in compressed package)

Preview component packaging graphic tutorial in cadence OrCAD capture schematic design interface

Tree topology networking structure of ZigBee module communication protocol

MOSFET的SOA或者ASO是什么?

Jedislock redis distributed lock implementation

pyspark案例系列4-dataframe输出到单个文件夹的解决方案

Pl/sql compilation check in kingbasees

白屏时间、首屏时间
随机推荐
NFT 2.0: 下一代的NFT将是精简且值得信赖的NFT
pyspark案例系列4-dataframe输出到单个文件夹的解决方案
Pagoda panel backup and recovery data
What is digital twin? A real-time and virtual representation
Where is it safer to open an account for soda ash futures? How much money can you do?
金仓数据KingbaseES 批量创建数据库对象
利用PHP开发的一款万能、表白墙系统部分代码片段
选择DC-DC开关电源控制器的实战过程
用真金做的电路板——金手指
Knowledge drop - personality analysis - four types of method
Detailed explanation of Lora module wireless transceiver communication technology
MySQL comparison
Batch add noise to data and generate new named annotation files
修复UICollectionView 没有到达底部安全区的问题
Use of kingbasees UDP monitoring tool for gold warehouse database
NFT产品是有生命的
Some understanding of inductive bias
Arbitrum 基础架构:快速入门
Use bat to write to the first line of the file
Finite cyclic group