当前位置:网站首页>Leetcode 1952. 三除数
Leetcode 1952. 三除数
2022-06-11 10:28:00 【我不是萧海哇~~~~】

给你一个整数 n 。如果 n 恰好有三个正除数 ,返回 true ;否则,返回 false 。
如果存在整数 k ,满足 n = k * m ,那么整数 m 就是 n 的一个 除数 。
示例 1:
输入:n = 2
输出:false
解释:2 只有两个除数:1 和 2 。
示例 2:
输入:n = 4
输出:true
解释:4 有三个除数:1、2 和 4 。
提示:
- 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;
}
};
边栏推荐
- Ngui, cooling effect
- Address of my bookmark
- MySQL transaction
- 微信小程序之点餐系统附源码
- After four years of outsourcing, it was abandoned
- Practical process of selecting DC-DC switching power supply controller
- NGUI,地图放大缩小
- Handwritten code call, apply, bind
- What is digital twin? A real-time and virtual representation
- Ngui, backpack drag and drop, and random cloning of picture knowledge points
猜你喜欢

BCGControlBar库专业版,完整记录的MFC扩展类

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

安全相关网站推荐

MySQL transaction

MySQL基础篇常用约束总结下篇

Reprint: linearlayout+fragment to achieve the lower navigation bar effect

Correct opening method of RPC | understand go native net/rpc package

Use of kingbasees UDP monitoring tool for gold warehouse database

Bcgcontrolbar Library Professional Edition, fully documented MFC extension class

DataGrip 2022,DataGrip 功能
随机推荐
Source code of digital collection app system
Circuit board made of real gold -- golden finger
[torch]: parallel training and can dynamically set the batch size of the first GPU
Detail measurement of DC-DC and PDN with network analyzer
What is the SOA or ASO of MOSFET?
Development and source code construction of digital collection system
电子设备辐射EMC整改案例
UGUI
NGUI,地图放大缩小
C # introductory series (11) -- multidimensional array
DataGrip 2022,DataGrip 功能
金仓数据库KingbaseES中的PL/SQL 编译检查
NGUI,选择性别男女
puppeteer入门之 BrowserFetcher 类
C语言课程设计题目
Habitable planet
Preview component packaging graphic tutorial in cadence OrCAD capture schematic design interface
Arbitrum 基础架构:快速入门
Use of kingbasees UDP monitoring tool for gold warehouse database
MySQL 权限管理和备份