当前位置:网站首页>模板_判断素数_开方 / 六素数法
模板_判断素数_开方 / 六素数法
2022-07-04 17:14:00 【这题AC再睡.】
// 开方
bool f( int n )
{
if( n<=3 ) return n>1;
for( int i=2;i<=n/i;i++ )
if( n%i==0 ) return false;
return true;
}
// 六素数法
bool f( int n )
{
if( n<=3 ) return n>1;
if( n%2==0 || n%3==0 ) return false;
for( int i=5;i<=n/i;i+=6 )
if( n%i==0 || n%(i+2)==0 ) return false;
return true;
}
边栏推荐
- 力扣刷题日记/day7/6.30
- [cloud voice suggestion collection] cloud store renewal and upgrading: provide effective suggestions, win a large number of code beans, Huawei AI speaker 2!
- 如何使用 wget 和 curl 下载文件
- Scala基础教程--16--泛型
- 如何提高开发质量
- fopen、fread、fwrite、fseek 的文件处理示例
- ThreadLocal原理与使用
- Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)
- 6.26CF模拟赛B:数组缩减题解
- Machine learning concept drift detection method (Apria)
猜你喜欢
Mysql5.7 installation tutorial graphic explanation
Halcon template matching
How to improve development quality
力扣刷题日记/day5/2022.6.27
How is the entered query SQL statement executed?
I always thought that excel and PPT could only be used for making statements until I saw this set of templates (attached)
Halcon模板匹配
基于C语言的菜鸟驿站管理系统
The block:usdd has strong growth momentum
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
随机推荐
Scala基础教程--15--递归
What types of Thawte wildcard SSL certificates provide
【210】PHP 定界符的用法
[system disk back to U disk] record the operation of system disk back to U disk
General environmental instructions for the project
Angry bird design based on unity
完善的js事件委托
Scala basic tutorial -- 17 -- Collection
Scala basic tutorial -- 18 -- set (2)
一种将Tree-LSTM的强化学习用于连接顺序选择的方法
How to modify icons in VBS or VBE
6.26cf simulation match B: solution to array reduction problem
Scala basic tutorial -- 15 -- recursion
[go language question brushing chapter] go conclusion chapter | introduction to functions, structures, interfaces, and errors
如何使用 wget 和 curl 下载文件
基于NCF的多模块协同实例
uni-app与uviewUI实现仿小米商城app(附源码)
Li Kou brush question diary /day3/2022.6.25
2022 national CMMI certification subsidy policy | Changxu consulting
蓝桥:合根植物