当前位置:网站首页>Template_ Judging prime_ Square root / six prime method
Template_ Judging prime_ Square root / six prime method
2022-07-04 20:06:00 【This question AC sleep again】
// prescribing
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;
}
// Six prime method
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;
}
边栏推荐
- kotlin 条件控制
- Reflection (I)
- 2022 Health Exhibition, health exhibition, Beijing Great Health Exhibition and health industry exhibition were held in November
- Basic use of kotlin
- [problem] Druid reports exception SQL injection violation, part always true condition not allow solution
- Educational codeforces round 22 E. Army Creation
- 求2的n次方
- 1011 World Cup betting (20 points) (pat a)
- kotlin 继承
- kotlin 基本数据类型
猜你喜欢
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
Creation of JVM family objects
Abc229 summary (connected component count of the longest continuous character graph in the interval)
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
HMM hidden Markov model and code implementation
实战模拟│JWT 登录认证
[problem] Druid reports exception SQL injection violation, part always true condition not allow solution
New wizard effect used by BCG
随机推荐
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
Kotlin inheritance
Pointnext: review pointnet through improved model training and scaling strategies++
1011 World Cup Betting (20 分)(PAT甲级)
Dark horse programmer - software testing - stage 07 2-linux and database -09-24-linux command learning steps, wildcards, absolute paths, relative paths, common commands for files and directories, file
kotlin 循环控制
Explicit random number
TCP两次挥手,你见过吗?那四次握手呢?
Jetpack Compose 教程
Utilisation de la barre de progression cbcggprogressdlgctrl utilisée par BCG
矩阵翻转(数组模拟)
多表操作-外连接查询
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
Mysql database basic operation -ddl | dark horse programmer
多表操作-内连接查询
Several methods of online database migration
Data set division
Swagger suddenly went crazy