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

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

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

  • poj_3134 IDA*
    #include   #include   #include   #include   #include   #include   using namespace std;   int deep,n;   int v[1005]={1};   int h(int top)   {       int k=deep-top;       int x=v[top];   请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
    2022-09-14 00:25:02下载
    积分:1
  • 常用的数学统计,希望大家喜欢 Calculate the approximation of the standard normal distributi...
    常用的数学统计算法,希望大家喜欢 Calculate the approximation of the standard normal distribution -commonly used mathematical statistical algorithm, hope you like Calculate the approximation of the stan DST normal distribution
    2022-05-08 07:44:15下载
    积分:1
  • 同步原语发送 & 接收
    发送和接收同步原语使用回声的客户机-服务器应用程序开发的Java实现
    2023-02-14 21:10:04下载
    积分:1
  • 大数,为了平常数据的输入,运处理
    大数算法,为了平常数据的输入,运算处理- The big number algorithm, for the ordinary data input, the operation processes
    2022-08-16 23:15:21下载
    积分:1
  • 基于角色访问控制代码
    基于角色访问控制代码,链表创建用户,无数据库, 对用户、角色、权限进行配置和管理;用户对角色的指派和权限到用户的指派 基于RBAC1的角色层次管理 基于RBAC2的互斥角色管理,共包含7条链,用户链(user)、角色链(role)、权限链( 请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
    2022-08-08 06:40:42下载
    积分:1
  • 矩阵处理的C语言源程序,包含一些矩阵处理的程序.  
    矩阵处理的C语言源程序,包含一些矩阵处理的程序.  -Matrix treatment of the C language source code, the matrix contains a number of treatment procedures.
    2022-03-01 00:14:54下载
    积分:1
  • 目标追踪
    目标追踪算法,自己结合 mean shift + kalman filter,效果还不错,半自动跟踪。毕设要求,结合了最简单的mean shift 算法,以及一个二维卡曼滤波器,实现了目标的实时跟踪监测,效果已经达到要求,在这里分享给大家。
    2022-07-14 22:24:18下载
    积分:1
  • 傅里叶变换fft
    How To Use void main(void) { gen_w_r2(w, N); // Generate coefficient table bit_rev(w, N>>1); // Bit−reverse coefficient table DSPF_sp_cfftr2_dit(x, w, N); // radix−2 DIT forward FFT // input in normal order, output in // order bit−reversed // coefficient table in bit−reversed // order DSPF_sp_icfftr2_dif(x, w, N); // Inverse radix 2 FFT 请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
    2022-03-02 15:55:21下载
    积分:1
  • ADT 数据结构的一个简单实现
    包含结构体的应用   以及相关文件的配合使用 当然还会用一些算法方面的知识   基于VC  6.0 的开发 想要学习数据结构这方面的知识你会发现这个源码会是一个很好的初步学习   领你入门的
    2022-03-11 11:40:48下载
    积分:1
  • 一款价值无量的曲线控件,只要在数据库导就可生成漂亮的拟合曲线...
    一款价值无量的曲线控件,只要在数据库导就可生成漂亮的拟合曲线-A curve of the control is of immeasurable value, as long as guide in the database can be generated fitting curves of a beautiful
    2022-02-03 14:49:55下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载