当前位置:网站首页>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;
}边栏推荐
- HDU 6440 2018 Chinese college student program design network competition
- Multi table operation inner join query
- Swagger suddenly went crazy
- 华为nova 10系列支持应用安全检测功能 筑牢手机安全防火墙
- Abc229 summary (connected component count of the longest continuous character graph in the interval)
- 1009 Product of Polynomials(25 分)(PAT甲级)
- English grammar_ Noun - use
- Kotlin classes and objects
- Jetpack Compose 教程
- How is the entered query SQL statement executed?
猜你喜欢

C # use stopwatch to measure the running time of the program

Euler function

Free soldier

HMM hidden Markov model and code implementation

解密函数计算异步任务能力之「任务的状态及生命周期管理」

华为nova 10系列支持应用安全检测功能 筑牢手机安全防火墙

输入的查询SQL语句,是如何执行的?

应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设

English语法_名词 - 使用

c# . Net MVC uses Baidu ueditor rich text box to upload files (pictures, videos, etc.)
随机推荐
PHP pseudo original API docking method
求2的n次方
牛客小白月赛7 谁是神箭手
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
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?
1003 emergency (25 points) (PAT class a)
Jetpack compose tutorial
Multi table operation inner join query
kotlin 基本使用
Kotlin classes and objects
HDU 1097 A hard puzzle
Offset function and windowing function
线上数据库迁移的几种方法
92. (cesium chapter) cesium building layering
kotlin 循环控制
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
1003 Emergency(25 分)(PAT甲级)
Actual combat simulation │ JWT login authentication
English语法_名词 - 使用