登录
首页 » 其他项目 » 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 153
下载积分: 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 个回复

  • 年会抽奖代码
    资源描述此程序为公司年会抽奖而开发 具体流程: 1、打开程序后显示总的控件界面,同时加载所有参与抽奖人员数据。 2、点击相应奖项会进入对应抽奖界面,点击空格,号码开始滚动。再次点击空格,号码停止滚动,本次抽取的中奖名单会滚动出现在号码框下方。每个奖项具体抽几次在程序中已写死。 3、某项抽奖结束后,已抽取的号码会从总数据中删除,同时写入对应的xls文件中保留。 4、开始下一项抽奖 5、所有奖项抽取完后点击获奖名单显示所有获奖人员名单
    2023-06-11 21:20:07下载
    积分:1
  • iperf 带宽测试工具
    iperf的是一种常用的网络测试工具,可以创建传输控制协议(TCP)和用户数据报协议(UDP)数据流,并测量承载它们的网络的吞吐量。iperf的是网络性能测量工具用C写的这是TTCP程序的重新实现兼容,是由分布式应用支持团队开发 (DAST)的国家实验室应用网络研究(NLANR),一个研究实验室,与大学合并 加州大学圣地亚哥分校的合作协会互联网数据分析(CAIDA)组,但其中被关闭的 2006年12月31日,由于受美国国家科学基金会的终止资助。iperf的允许用户设置可用于测试网络的各种参数,或者用于优化或调整 一个网络。 iperf的具有客户机和服务器的功能,并且可以单向地测量两个端部之间的通过量,或者 或双向。它是开放源代码软件,并运行于各种平台,包括Linux,Unix和Windows(无论是本地或内部的Cygwin[1])。UDP:当用于测试的UDP容量的Iperf允许用户指定数据报的大小,并提供结果的数据报吞吐量和包丢失。TCP:当用于检测的TCP容量的Iperf测量有效载荷的吞吐量。 iperf的使用1024×1024兆字节,1000×1000兆。
    2022-05-12 20:20:29下载
    积分:1
  • 数字拼图游戏 鼠标点击就可以玩。 学习VB的习作,但功能完整...
    数字拼图游戏 鼠标点击就可以玩。 学习VB的习作,但功能完整-Digital jigsaw puzzle mouse clicks you can play. VB learning assignments, but the functional integrity of the
    2022-02-21 10:38:39下载
    积分:1
  • 理论考试程序,可以自由下载,学习,请多多指点,批评
    理论考试程序,可以自由下载,学习,请多多指点,批评-Theoretical examination procedures, are free to download, study, please advice, criticism
    2023-02-11 02:20:04下载
    积分:1
  • 用于矩阵地相乘,矩阵的转置以及逆矩阵的求法
    用于矩阵地相乘,矩阵的转置以及逆矩阵的求法-For matrix multiplication, transpose and inverse matrix method of seeking
    2022-03-22 03:51:12下载
    积分:1
  • 各种解码译码电路模型的VerilogHDL描述
    各种解码译码电路模型的VerilogHDL描述-various decoder decoding circuit model of Verilog HDL description
    2022-03-24 22:22:13下载
    积分:1
  • 一个小的文件分割器。
    一个小的文件分割器。-a small file dividers.
    2022-03-17 20:34:39下载
    积分:1
  • 240128程序
    stm32f103系列mcu驱动ra6963液晶控制芯片源代码。RA6963是一个文字与绘图模式的点矩阵液晶显示(LCD) 控制器, 它可以支持大部份的液晶驱动器,用于各式标准化与客制化LCD模块。 内建256-word的ROM字形产生器,可以显示基本英文字型、数字符号等字母, 并支持最大64KByte的外部显示内存(Display RAM),可用于文字显示模式、绘图显示模式及两总混合显示模式, 显示窗口也可以轻易的在显示内存范围内移动。在MCU接口方面,RA6963支持8080系列之MCU, 提供8-Bit的数据总线接口,功能上与T6963C完全兼容。
    2022-03-20 01:16:17下载
    积分:1
  • read your package and describe it at least 40 bytes in English.
    read your package and describe it at least 40 bytes in English.
    2022-03-17 16:26:12下载
    积分:1
  • Single round robin tournament players winning sequence to solve the problem name...
    单循环赛中选手胜负序列求解问题 名称:单循环赛中选手胜负序列求解问题 内容:有n个选手 P 1 ,P 2 ,P 3 ,… ,P n 参加了的单循环赛,每对选手之间非胜即负。现要求求出一个选手序列 P 1 ,P 2 ,P 3 ,… ,P n , 使其满足 P i 胜 P i+ 1 (i=1,… ,n-1) 。 -Single round robin tournament players winning sequence to solve the problem name: the outcome of single round-robin tournament players to solve the problem sequence elements: There are n-player P 1, P 2, P 3, ..., P n participated in a single round-robin between each pair of players Non-win or negative. Players are now required to find a sequence of P 1 " , P 2" , P 3 " , ..., P n" , to meet the P i " W P i+ 1" (i = 1, ..., n-1).
    2022-04-01 08:15:51下载
    积分:1
  • 696518资源总数
  • 106208会员总数
  • 21今日下载