文件名称:prime
介绍说明--下载内容均来自于网络,请自行研究使用
素数环: 把从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
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
(系统自动生成,下载前可以参看下载内容)
下载文件列表
素数环.cpp
素数环.exe
素数环.o
素数环.exe
素数环.o