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

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

于 2022-03-13 发布 文件大小:54.02 kB
0 188
下载积分: 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 个回复

  • C++实现的MMAS蚁群工程
    一种基于c++实现的MMAS蚁群算法,主要改进如下:1.采用精英策略,只对最优路径上的蚂蚁信息素进行更新;2.通过最大最小信息素值修剪信息素矩阵;
    2022-11-12 12:55:03下载
    积分:1
  • 全区间积分的阿当姆斯方
    全区间积分的阿当姆斯方法-region between Integral Methods A ADAMS
    2022-01-26 03:07:44下载
    积分:1
  • 数独巧妙
    偶遇数独游戏,了解了其中规则后,自己用c++做了一个数独矩阵生成程序,效率自认为比较高,欢迎大家交流!
    2022-08-14 02:00:18下载
    积分:1
  • mtlab中INV()求逆函数的C++代码
    资源描述在matlab中,inv()函数一一个自带十分快速的求逆的算法,但是在matlab中是不公开的,为了方便,本程序将INV()函数做出C++代码方便用户的使用。
    2023-06-22 13:50:03下载
    积分:1
  • 刚才弄错了,这才是第二个源码,可以实现输入一二叉树的前序与中序,输出其后序...
    刚才弄错了,这才是第二个源码,可以实现输入一二叉树的前序与中序,输出其后序-have just made a mistake, this is the second source, can achieve an input sequence of binary tree with the sequence, then the output sequence
    2022-03-04 21:26:50下载
    积分:1
  • 推荐系统-协同过滤
    应用背景 java实现的几个推荐算法:slopeone SVD,RSVD,ItemNeighborSVD  由于只是为了看看RMSE效果,因此很多功能都没完善 这个代码是我从网上看到的,感觉对我学习推荐算法很有用,因此放上了大家共享,希望对大家会有用. 关键技术  如果需要跑起来看效果,那么你需要 1. 下载movielens数据集,建议使用 1000W数据集  http://www.grouplens.org/sites/www.grouplens.org/external_files/data/ml-10m.zip 2. 查看修改regeneration.py 重新生成一遍数据集。再修改运行common下的DataConverter生成算法需要的格式 3. 根据需要修改test目录里的代码,运行。参数配置可先不动,
    2022-08-26 04:21:40下载
    积分:1
  • 用tc来计pi的精确计
    用tc来计算pi的精确计算-used to calculate the precise calculation of pi
    2022-03-18 11:52:47下载
    积分:1
  • numerical integration : Key words : numerical integration approximate interpolat...
    数值积分:关键词:数值积分 近似 插值求积 梯形 辛普生 复化 逐次分半 龙贝格-numerical integration : Key words : numerical integration approximate interpolation Quadrature trapezoidal Simpson Health Minute of successive half Romberg
    2022-03-25 08:35:29下载
    积分:1
  • 模拟计器的实现,可以进行基本的运
    模拟计算器的实现,可以进行基本的运算-the realization simulation calculators, the basic arithmetic
    2022-03-26 02:18:09下载
    积分:1
  • Taflove 的FDTD的经典书籍,非常值得期待的FDTD教程。相信大家喜欢...
    Taflove 的FDTD算法的经典书籍,非常值得期待的FDTD教程。相信大家喜欢-Taflove the FDTD algorithm is the classic book, well worth looking forward to the FDTD tutorial. I believe that everyone likes
    2022-12-21 15:10:03下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载