-
Find prime numbers prepared by screening the function: void sieve (bool isPrime...
编写筛选查找素数函数:
void sieve(bool isPrime[], int n)
其中isPrime[ ]为一个布尔型数组,n为数组大小。由于2是第一个素数,
所以设置isPrime[0]和isPrime[1]的值为false,并设置其余的元素初值为true。
然后对从4到n-1的每一个i,判断i是否能够被2整除,如果i能够被2整除,则设置isPrime[i]为false。
对从2到n/2的每一个可能的数值重复以上处理,当操作结束时,所有值为true的isPrime[i]所对应的i就是素数,它们将是从筛子中掉下来的。-Find prime numbers prepared by screening the function: void sieve (bool isPrime [], int n) which isPrime [] as a Boolean array, n is the size of the array. Because 2 is the first prime number, so set the isPrime [0], and isPrime [1] a value of false, and set the initial value of the remaining elements of true. And then from 4 to n-1 for each i, to determine whether i can be divisible by 2, if i can be divisible by 2, then set the isPrime [i] is false. From 2 to n/2 possible values for each one to repeat the above processing, when the operation ended, all the true value of the isPrime [i] corresponding to i is a prime number, they will be falling from the sieve in the past.
- 2023-03-02 04:45:03下载
- 积分:1
-
Please read your package and describe it at least 40 bytes.
System will automat...
Please read your package and describe it at least 40 bytes.
System will automatically delete the directory of debug and release, so please do not put files on these two directory
- 2022-08-14 07:19:32下载
- 积分:1
-
(VMM验证方法手册)试剂盒(ver1.1c)导师的Questa和措施…
VMM(Verification Methodology Manual) Kit (Ver1.1C) for Mentor s Questa and Incisive Software
- 2022-02-04 06:19:07下载
- 积分:1
-
这是我的计算机图形学的实验――梁友栋算法
这是我的计算机图形学的实验――梁友栋算法-This is my experimental computer graphics-- friends of Liang Dong Algorithm
- 2022-02-26 08:36:13下载
- 积分:1
-
用PIC16F887做的4个触摸按键的例程
用PIC16F887做的4个触摸按键的例程-M-TOUCH SAMPLE CODE FOR PIC16F887
- 2022-06-12 13:09:46下载
- 积分:1
-
一个简单的示例代码创建一个SPIM装配清单和调用函数
A simple spim assemply example code on creating a list and calling functions
- 2022-04-26 12:35:06下载
- 积分:1
-
都 是好东西,不是精品我不发的。大家要珍惜机会
都 是好东西,不是精品我不发的。大家要珍惜机会-are good but not excellent, I do not issued. We should treasure this opportunity
- 2022-06-30 21:59:11下载
- 积分:1
-
dbExpress连接MYSQL4.0以上版本
用dbexpress连接mysql4.0以上的版本 -dbexpress connected with the above version mysql4.0
- 2022-08-05 13:00:35下载
- 积分:1
-
将 ASM 源程序变为 TURBO
将 ASM 源程序变为 TURBO-C的内联模块,将汇编语言和c语言联合使用-will ASM source into TURBO-C in conjunction with the modules will be compiled language and the joint use of language c
- 2022-01-27 20:47:22下载
- 积分:1
-
此程序是一个dos下日历.
此程序是一个dos下日历.-This program is a calendar under dos.
- 2022-07-06 15:11:55下载
- 积分:1