-
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
-
linux 下的vi / vim的编辑工具.具有详细的操作说明
linux 下的vi / vim的编辑工具.具有详细的操作说明-under linux vi/vim editing tools. A detailed statement of operations
- 2023-07-08 18:35:03下载
- 积分:1
-
在 NS2 中创建无线模拟器
Tcl 脚本帮助创建无线网络模拟器软件所加强的创新理念。欢迎大家下载、试用。谢谢大家的支持。
- 2022-09-17 17:15:03下载
- 积分:1
-
微机原理课程设计整点报时系统,武汉理工大学开发的试验箱!...
微机原理课程设计整点报时系统,武汉理工大学开发的试验箱!-Microcomputer Principles of curriculum design, the whole point timekeeping system, Wuhan University of Technology developed by Chambers!
- 2022-12-19 05:25:03下载
- 积分:1
-
服装商店网站
在线购物网站使用 jquery 效果。用户可以在某些类别的衣服上显示的图像,并把描述和价格。网站可以按类型和大小进行筛选。
很好的网上服装店或其他。
- 2022-04-19 08:34:18下载
- 积分:1
-
VB6.0的USB HID访问示例代码和通用模块文件
vb6.0 访问USB HID设备的示例代码和通用模块文件-vb6.0 USB HID visit the sample code modules and common document
- 2022-12-28 12:50:03下载
- 积分:1
-
现非常流行的非接触IC卡Mifare one S70的卡操作资料。操作S70卡必备。...
现非常流行的非接触IC卡Mifare one S70的卡操作资料。操作S70卡必备。-Is a very popular non-contact IC card of Mifare one S70 data card operated. Operation S70 card required.
- 2022-02-04 04:31:18下载
- 积分:1
-
linux 下安装oracle92 rac系统
linux 下安装oracle92 rac系统-oracle92 rac install linux system
- 2022-02-12 13:28:48下载
- 积分:1
-
一种用硬件信息获取系统的硬件信息例子
一个用vc获取系统硬件信息的例子-vc access to a system with hardware information example
- 2022-03-23 14:47:50下载
- 积分:1
-
SMS Messenger Mobile 104
SMS Messenger Mobile 104
- 2022-01-23 10:16:36下载
- 积分:1