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

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

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

  • 我的一个MATLAB牛顿插值程序 我还很菜 请多多指教 批准加入 谢谢!...
    我的一个MATLAB牛顿插值程序 我还很菜 请多多指教 批准加入 谢谢!-a MATLAB Newton interpolation procedures, I also ask you to enlighten vegetables approval Thank you!
    2022-08-23 03:36:47下载
    积分:1
  • Computational fluid dynamics as a new method of landmark
    作为对计算流体力学划时代共享的新方法。roe格式对于差分格式的构造提供了新的全新的领域!Fortran编写-Computational fluid dynamics as a new method of landmark-sharing. roe format structure for the difference scheme provided a new field of brand new! Fortran prepared
    2022-06-16 12:39:03下载
    积分:1
  • C++编写的快速离散余弦变换
    快速DCT(离散余弦变换) 也许对图像处理有用。
    2022-03-31 18:56:19下载
    积分:1
  • HDMI显示
    关于HDMI显示,Verilog语言,采用1280*720的分辨率,通过添加自己的逻辑即可实现不同的图像,具体使用参考附件中说明,HDMI显示采用SiI9134驱动芯片,很好的兼容不同的数据格式。
    2023-05-19 00:00:04下载
    积分:1
  • dda algorithm is the basic algorithm in computer graphics, very useful, it is re...
    dda算法是计算机图形学的基本算法,非常实用,建议大家用。可以画直线-dda algorithm is the basic algorithm in computer graphics, very useful, it is recommended by everyone. Can draw a straight line
    2022-12-28 09:10:03下载
    积分:1
  • 《VC++ 常用数值算法》代码,包含众多常用算法,值得学习参考!...
    《VC++ 常用数值算法》代码,包含众多常用算法,值得学习参考!-"VC numerical algorithm commonly used" code contains many commonly used algorithms, it is worth studying reference!
    2022-01-23 11:04:10下载
    积分:1
  • 3*3耦合器解调算法
    基于光纤分布式马赫-曾德干涉仪的3*3耦合器解调算法,这种基于对称3×3 耦合器解调方法,该种解调法对于微、强振动两种信号都适用,这是由于该解调法解调出来的结果不仅准确,而且快速,其动态范围也是很大的。
    2022-03-20 17:05:19下载
    积分:1
  • face recognition
    应用背景This is an application-based VC prepared to read camera Face to Face Recognition and face detection software. cited in the MATLAB system function, is a very good face recognition software. The system in my school examination papers reply obtained outstanding achievements. We hope to useful关键技术这是一个应用VC++编写的基于摄像头读取人脸的人脸识别和人脸检测软件,其中引用了MATLAB的系统函数,是一个非常不错的人脸识别软件,这个系统在我校论文答辩审核中获得了优秀的成绩。希望对大家有用
    2022-08-15 04:54:37下载
    积分:1
  • FOC无传感器源代码
    资源描述GD32F103 FOC无传感器代码,全部开放源代码可以方便移植到其他平台
    2022-03-21 11:31:24下载
    积分:1
  • SURF示例源码
    SURF算法示例 作为尺度不变特征变换算法(Sift算法)的加速版,Surf算法在适中的条件下完成两幅图像中物体的匹配基本实现了实时处理,其快速的基础实际上只有一个——积分图像haar求导。 Hessian矩阵是Surf算法的核心,为了方便运算,假设函数f(z,y),Hessian矩阵H是由函数,偏导数组成:
    2023-05-04 22:25:02下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载