登录
首页 » 算法 » 素数环: 把从1到10这10个数摆成一个环,要求相邻的两个数的和是一个素数。 〖问题分析〗 这是一道回溯的题目。从1开始,每个空位有9种可能,每种可能加入约束...

素数环: 把从1到10这10个数摆成一个环,要求相邻的两个数的和是一个素数。 〖问题分析〗 这是一道回溯的题目。从1开始,每个空位有9种可能,每种可能加入约束...

于 2022-03-13 发布 文件大小:54.02 kB
0 181
下载积分: 2 下载次数: 1

代码说明:

素数环: 把从1到10这10个数摆成一个环,要求相邻的两个数的和是一个素数。 〖问题分析〗 这是一道回溯的题目。从1开始,每个空位有9种可能,每种可能加入约束条件即可 1.与前面所有的数不重复 2.与前一个数和为素数(最后一个和第一个也要满足)。 〖算法流程〗 1、数据初始化; 2、递归填数: 判断第J种可能是否合法; A、如果合法:填数;判断是否到达目标(10个已填完): 是,打印结果;不是,递归填下一个; B、如果不合法:选择下一种可能;-Prime Central: 1-10 from 10 the number of put this into a ring, asked the two adjacent numbers and is a prime number. 〗 〖Analysis is a retrospective this topic. From 1 year, 9 out of every space possible, each may be bound by the conditions of accession to 1. And in front of all the number of non-repetition, 2. With a few and for a prime number (the last and the first to meet). 1〗 〖algorithm processes the data to initialize 2, fill in the number of recursion: first to determine the legality of J possible A, if the legitimate: the number of Reclamation to determine whether the target (10 have been completed): Yes, print the results of not, fill in the next recursive B, if not legitimate: a possible alternative

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

发表评论

0 个回复

  • 格式操作
    字符串格式,concat 字符串,长度的字符串,使用 vb 6.0,可以帮助程序员为计数,并知道字符串的长度
    2022-07-15 12:01:40下载
    积分:1
  • 超市管理系统
    应用背景这是一个自己编写的学生超市管理系统,内容包括界面设计、数据库管理等等多个方面,是比较全面的超市管理程序关键技术用C++编写的程序,关机那技术就是MFC编写的界面和C++编写的程序,内部注释是比较详细的,很方便之后的理解
    2022-05-17 15:45:00下载
    积分:1
  • 实施基本例程在Matlab和奥克塔夫(目前利用Matlab R13)为S.
    implement basic routines in Matlab and Octave (currently using Matlab R13) for simulating adaptive beamforming and filtering for antenna arrays.
    2023-02-01 14:30:03下载
    积分:1
  • PSO解决背包问题
    背包问题
    2023-07-25 04:35:03下载
    积分:1
  • 利用KDD1999数据集进行K
    利用KDD1999数据集进行K-means算法的实现-Mathimatics-Numerical algorithms
    2022-02-04 02:05:42下载
    积分:1
  • A c++program to demonstrate Radix sorting
    这是一个c++程序,演示基数按升序排序。程序通过请求数字或元素的总数来接受用户的输入。然后使用基数排序方法按升序对输入的数字进行排序。通过将代码粘贴到编译器中,运行和编译非常容易。
    2022-05-30 08:58:36下载
    积分:1
  • 采用相互垂直的两个振子构成圆极化天线的FDTD程序.可以计其圆极化波瓣宽度等天线指标...
    采用相互垂直的两个振子构成圆极化天线的FDTD程序.可以计算其圆极化波瓣宽度等天线指标 -perpendicular to each other using the two oscillator constitute a circularly polarized antenna FDTD procedures. Can calculate its lobed circular polarization antennas width indicators
    2022-06-11 13:09:35下载
    积分:1
  • http代理
    c语言完成的http代理,完成功能:获取浏览器的get报文;修改报文的Encoding-type; GET报文中转到web服务器,代理接收服务器的内容,解析content-length, 或trunked的http回文,再中转给浏览器。可以在应用层实现,http报文的修改。
    2022-06-12 22:09:13下载
    积分:1
  • smpl是一个排队论的仿真软件,用这个软件做排队论模型的仿真有灵活高效的特点,这块软件是最早的一款排队论模型仿真软件...
    smpl是一个排队论的仿真软件,用这个软件做排队论模型的仿真有灵活高效的特点,这块软件是最早的一款排队论模型仿真软件-smpl is a queuing theory, simulation software, using this software to do simulation of queuing theory model of flexible and efficient characteristics, the earliest piece of software is a queuing theory model of simulation software
    2022-03-20 23:23:12下载
    积分:1
  • 特征值提取程序
    信号分解后进行特征值提取。包含均值、方根幅值、均方根值、最大值、标准差、偏斜度、峭度、峰值因子、裕度因子、波形因子、脉冲因子、方差等多种特征值,可以进行多个或者单个特征值的输出。在模式识别领域或者是振动噪声分析领域很有用处。
    2023-03-06 22:00:03下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载