-
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
-
Extract the source code, VB language, comparative ease of use, I tried
解压缩源码,VB语言的,比较好用,我试过-Extract the source code, VB language, comparative ease of use, I tried
- 2022-02-28 20:22:23下载
- 积分:1
-
Minigof 迷你高尔夫游戏源代码(手机版)
Minigof 迷你高尔夫游戏源代码(手机版)-Minigof mini-golf game source code (mobile version)
- 2022-03-06 14:20:06下载
- 积分:1
-
这个论坛也不错.适合做毕业设计的,包含大多数基本功能
这个论坛也不错.适合做毕业设计的,包含大多数基本功能-this forum is a good one. Suitable for graduation design, including most of the basic functions
- 2022-06-21 02:47:19下载
- 积分:1
-
魔兽世界登陆器易语言第一版
界面不错
魔兽世界登陆器易语言第一版
界面不错 -World of Warcraft landers good easy interface language first edition
- 2022-03-20 03:41:43下载
- 积分:1
-
判断手机号码是否吉凶的小东西
判断手机号码是否吉凶的小东西-judge whether the phone numbers of small things good and bad.
- 2022-02-03 20:43:54下载
- 积分:1
-
一个将数字转换成文本(例如32转换成thirty two)
一个将数字转换成文本(例如32转换成thirty two)--Program which transforms from digit to text (eg: transforms 32 to thirty two)
- 2023-07-17 23:05:02下载
- 积分:1
-
这是一张ascii表,学计算机的人都知道它的作用,这里我就不多说了。...
这是一张ascii表,学计算机的人都知道它的作用,这里我就不多说了。-This is a ascii table, a computer who know their role, I am not here to talk a lot.
- 2022-02-11 10:31:28下载
- 积分:1
-
这是一个用multisim编写的时钟,主要由芯片级联而成
这是一个用multisim编写的时钟,主要由芯片级联而成-This is a clock with Multisim prepared mainly by the chip cascade from
- 2022-01-24 17:21:01下载
- 积分:1
-
灰色预测的MATLAB程序,只要你将输入向量换成你的数据,结果、检验都出来了...
灰色预测的MATLAB程序,只要你将输入向量换成你的数据,结果、检验都出来了-Gray forecast MATLAB program, as long as you replace the input vector of your data, the results, testing all out. . .
- 2022-01-27 16:14:40下载
- 积分:1