当前位置:网站首页>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;
}
边栏推荐
- 数据集划分
- 1006 sign in and sign out (25 points) (PAT class a)
- Introduction to ACM combination counting
- Creation of JVM family objects
- 1005 spell it right (20 points) (pat a)
- 1009 product of polynomials (25 points) (PAT class a)
- kotlin 条件控制
- C# 使用StopWatch测量程序运行时间
- 2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
- In the first month of its launch, the tourist praise rate of this campsite was as high as 99.9%! How did he do it?
猜你喜欢
Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading
[problem] Druid reports exception SQL injection violation, part always true condition not allow solution
Siemens HMI download prompts lack of panel image solution
C语言-入门-基础-语法-流程控制(七)
多表操作-内连接查询
Pointnet / pointnet++ point cloud data set processing and training
Wireshark network packet capture
Stream stream
西门子HMI下载时提示缺少面板映像解决方案
Development and construction of DFI ecological NFT mobile mining system
随机推荐
TCP waves twice, have you seen it? What about four handshakes?
Process of manually encrypt the mass-producing firmware and programming ESP devices
HDU 6440 2018 Chinese college student program design network competition
Several methods of online database migration
kotlin 继承
Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
多表操作-外连接查询
Kotlin cycle control
kotlin 循环控制
需求开发思考
Kotlin basic data type
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
Niuke Xiaobai monthly race 7 I new Microsoft Office Word document
HMM hidden Markov model and code implementation
Jetpack Compose 教程
SSRS筛选器的IN运算(即包含于)用法
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
Wireshark network packet capture
PHP pseudo original API docking method
BCG 使用之新建向导效果