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

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

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

  • 为使网格的代数方法
    algebric method to make mesh
    2023-07-11 08:15:02下载
    积分:1
  • 算术编码五美分
    Five Cents on Arithmetic Encoding
    2023-06-04 21:25:03下载
    积分:1
  • Numerical Anaysis 8th Edition, by Burden and Faires (Pascal Source)
    Numerical Anaysis 8th Edition, by Burden and Faires (Pascal Source)
    2022-02-12 01:32:05下载
    积分:1
  • procedures used in the calculation of the distribution of tasks, task allocation...
    该程序用于计算任务分配问题,任务分配问题也是运筹学中一个较难的问题。-procedures used in the calculation of the distribution of tasks, task allocation problem is tacticians had a more difficult problem.
    2022-06-16 01:19:43下载
    积分:1
  • 基于51ds1302、ds18b20数码管显示
    基于51ds1302、ds18b20数码管显示 基于51ds1302、ds18b20数码管显示基于51ds1302、ds18b20数码管显示基于51ds1302、ds18b20数码管显示基于51ds1302、ds18b20数码管显示
    2022-02-14 12:10:53下载
    积分:1
  • C语言链表学习
    应用背景C学习、链表掌握与提高、汽车管理系统关键技术链表、汽车管理系统,基于C语言编程的汽车管理系统,分别包括,注册信息、车次的统计与修改、用户订票(退票、订票)。基于链表,简单直观,方便学习链表的同学对链表进行理解加深,简单明了。
    2022-02-02 22:07:47下载
    积分:1
  • c语言数值计算算法,包括各种排序算法、差值、迭代等
    c语言数值计算算法,包括各种排序算法、差值、迭代等-c language numerical algorithms, including sorting algorithm, the margin, such as iterative
    2022-08-03 13:33:38下载
    积分:1
  • 一种模糊卡尔曼滤波器的设计
    一种模糊卡尔曼滤波器的设计- One kind of fuzzy kalman filter design
    2022-03-29 17:20:32下载
    积分:1
  • 你好世界
    应用背景adasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddспомощьюVинаспомощьюVинав。в。спомощьюVинаadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasdddddddddddddddddddddddddddddddddddddddddddadasddddddddddddddddddddddddddddddddddddddddddd关键技术234567891011121314151617181920РазмерА(- 2,- 4) ; ;делаюя= - 3,2читать*,(В(Я,какДж),ДжвС= - 4,0) ;конецсделатьзвонокмассивные(В,Н)печать*,встопконецподпрограммымассивные(В,Н)измерениеВ(Н) ; ;нея= 2,н2СделатьДж=Я,НВвKиВ=Н-ДЖ+Яесли(в(
    2022-01-22 11:45:09下载
    积分:1
  • 非常好,非常有名的求解线性规划和混合整型规划的源代码,用c语言编写,作者M. Berkelaar...
    非常好,非常有名的求解线性规划和混合整型规划的源代码,用c语言编写,作者M. Berkelaar-very good, very well-known for linear programming and mixed-integer planning the source code, using the c language, the author M. Berkelaar
    2022-12-02 08:05:03下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载