-
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
-
neural network series information and construction.
neural network series information and construction.
- 2022-07-06 23:38:29下载
- 积分:1
-
一个用Java开发的细胞自动机
一个用Java开发的细胞自动机-a Java development Cellular Automata
- 2023-07-02 22:35:03下载
- 积分:1
-
A more detailed summary, individuals spent a day writing, good yo
比较详细的总结,个人花了一天写的,很好的哟-A more detailed summary, individuals spent a day writing, good yo
- 2022-09-08 17:20:03下载
- 积分:1
-
The quartus achieve the PC
在quartus下实现了PC机的串口通信功能-The quartus achieve the PC-Serial communication function
- 2022-01-25 15:27:09下载
- 积分:1
-
手机益智游戏
手机益智游戏-贴方块,索爱S700版本(屏幕240*320),J2ME开发,160关,好玩-mobile puzzle games- posted cubes, Sony Ericsson S700 version (240* 320 screen), J2ME development, 160 customs and fun
- 2022-03-25 22:36:37下载
- 积分:1
-
labview程序编程技巧演示,用labview编写windows应用图像编程小程序...
labview程序编程技巧演示,用labview编写windows应用图像编程小程序-LabVIEW programming skills demonstration, prepared by LabVIEW image windows programming applet
- 2022-05-09 07:13:23下载
- 积分:1
-
Language programming of 100 cases
c语言编程100例,介绍了一些问题的编程-Language programming of 100 cases
- 2022-02-06 22:03:43下载
- 积分:1
-
全部用W32 API制作,简单的,好玩的贪食双蛇游戏
全部用W32 API制作,简单的,好玩的贪食双蛇游戏-all produced using Win32 API, a simple, fun game glutton snake-
- 2022-03-20 15:42:42下载
- 积分:1
-
GPS的数据处理,坐标变换比较经典,采用vc++实现,值得下载奥,...
GPS的数据处理,坐标变换比较经典,采用vc++实现,值得下载奥,-GPS data processing, comparing the classical coordinate transformation, using vc++ Achieve, it is worth downloading Austria,
- 2022-09-22 15:50:02下载
- 积分:1