文件名称:03
介绍说明--下载内容均来自于网络,请自行研究使用
子集和问题的一个实例为〈S,t〉。其中,S={x1 ,x2 ,…,xn }是一个正整数的集合,c是一个正整数。子集和问题判定是否存在S的一个子集S1,使得S1中元素的和等于c,设计一个解子集和问题的回溯算法.
输入:
第一行2个数,n(集合S的大小)和c(子集和的目标值)
第二行n个数表示集合中的元素
输出:无解时输出一行"No Solution!↵ "(中间一个空格)
有解时输出子集中的元素
如:
输入:
5 10
2 2 6 5 4
输出
2 2 6
-Subset of the problem and an example for < S,t> . Of which, S = (x1, x2, ..., xn) is a set of positive integers, c is a positive integer. And problems in a subset of S to determine whether there is a subset of S1, made of elements in S1 and the mean c, subset of the design of a solution of the backward algorithm and issues. Input: 2 Number of the first line, n (set size S) and c (sub-sets and the target) that the second line of n number of output elements of the collection: no solution when the output of his " No Solution! ↵ " (the middle of a space) to solve subset when the elements of output such as: input : 51,022,654 output 2 2 6
输入:
第一行2个数,n(集合S的大小)和c(子集和的目标值)
第二行n个数表示集合中的元素
输出:无解时输出一行"No Solution!↵ "(中间一个空格)
有解时输出子集中的元素
如:
输入:
5 10
2 2 6 5 4
输出
2 2 6
-Subset of the problem and an example for < S,t> . Of which, S = (x1, x2, ..., xn) is a set of positive integers, c is a positive integer. And problems in a subset of S to determine whether there is a subset of S1, made of elements in S1 and the mean c, subset of the design of a solution of the backward algorithm and issues. Input: 2 Number of the first line, n (set size S) and c (sub-sets and the target) that the second line of n number of output elements of the collection: no solution when the output of his " No Solution! ↵ " (the middle of a space) to solve subset when the elements of output such as: input : 51,022,654 output 2 2 6
(系统自动生成,下载前可以参看下载内容)
下载文件列表
子集和问题.cpp
子集和问题.txt
子集和问题.txt