登录
首页 » 其他项目 » Find prime numbers prepared by screening the function: void sieve (bool isPrime...

Find prime numbers prepared by screening the function: void sieve (bool isPrime...

于 2023-03-02 发布 文件大小:1.12 MB
0 124
下载积分: 2 下载次数: 1

代码说明:

编写筛选查找素数函数: 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.

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 本系统的使用可以将工作的部分流程使用计算机的办公自动化处理,能够极大的提高办公的效率和准确程度。另外,可以便捷的统计和分析各种所需资料,方便相应政策的调整等。...
    本系统的使用可以将工作的部分流程使用计算机的办公自动化处理,能够极大的提高办公的效率和准确程度。另外,可以便捷的统计和分析各种所需资料,方便相应政策的调整等。 该系统作为网上信息管理系统,实现网络处理功能。系统采用先进的应用系统体系结构和开发模式,提高系统的可扩展性、可维护性和交互性。该系统相对独立,接口实现简单、安全,可操作性强-the use of the system can be part of the process of using computers for office automation, the ability to greatly improve office efficiency and accuracy. In addition, the user can analyze statistics and information required to facilitate the corresponding policy adjustments. The system as a web-based information management system, network processing functions. The system uses advanced application system architecture and development model to improve the scalability, maintainability and interactive. The system relatively independent interface is simple, safe and operable
    2022-07-10 04:28:56下载
    积分:1
  • 使用LabVIEW编写的一个计算器程序。计算器完成计算…
    使用LabVIEW编写的一个计算器程序。 计算器能完成的运算: 加减乘除,求平方,求立方,求自然对数,求以10为底的对数,求阶乘求正弦余弦正切值,符号取反 能完成的操作:角度与弧度的切换,退格,清零 缺点:由于显示使用的是数值类型,所以无法实现小数输入;只能进行十进制的计算,不支持其它进制,统计功能未实现-LabVIEW prepared to use a calculator program. Calculator to complete the calculations: addition and subtraction multiplication and division, and square, and cubic, and the natural logarithm, and to 10 for the end of the logarithm, and factorial values for sine cosine tangent, symbols take to complete the operation of the anti: the angle with radian switch, backspace, Clear shortcomings: As the show using a numerical type, it is not possible to realize a small number of input only for the calculation of the metric system, do not support the other band, did not achieve statistical functions
    2023-08-17 06:20:03下载
    积分:1
  • orcad原理图绘制教程。60分钟可学会。
    orcad原理图绘制教程。60分钟可学会。-orcad schematic drawing tutorial. 60 minutes to learn.
    2022-03-21 07:20:55下载
    积分:1
  • 发布整站源码 可以再开发~ 本人实用中 效果嗷嗷滴~
    发布整站源码 可以再开发~ 本人实用中 效果嗷嗷滴~-Release the whole point source can be developed in practical effect ~ I嗷嗷drops ~
    2023-02-18 03:40:03下载
    积分:1
  • 电子设计与CAD 电子设计与CAD
    电子设计与CAD 电子设计与CAD-Electronic Design and CAD
    2022-02-09 15:25:59下载
    积分:1
  • controls name : Date Controls
    控件名称:日期控件-controls name : Date Controls
    2022-03-06 03:02:20下载
    积分:1
  • javaWeb教程
    javaWeb教程-javaWeb Guide
    2022-09-25 23:40:04下载
    积分:1
  • Tc2.0编写俄罗斯方块游戏
    Tc2.0编写俄罗斯方块游戏-Tc2.0 prepared Tetris game
    2022-08-20 12:20:46下载
    积分:1
  • TCL_教程 学习tcl脚本语言的首选
    TCL_教程 学习tcl脚本语言的首选-Tutorial TCL_ learning tcl scripting language of choice
    2022-02-01 04:46:52下载
    积分:1
  • 跳舞机,vb小程序,可以作为初学者的小游戏,比较好玩
    跳舞机,vb小程序,可以作为初学者的小游戏,比较好玩-跳舞机, vb applet can be used as a beginner" s game, more fun
    2023-03-14 22:25:04下载
    积分:1
  • 696518资源总数
  • 105595会员总数
  • 1今日下载