由买买提看人间百态

topics

全部话题 - 话题: vindex
(共0页)
x***y
发帖数: 633
1
another way to use backtracking
//find all the commbination
typedef vector::size_type VecIndex;
void find_all_comb ( unsigned target, vector & vec, vector >& eleCount, VecIndex vIndex){
//vec is assumed sorted
if(vIndex==vec.size())
return ;
unsigned mul = target/vec[vIndex];
eleCount[vIndex] = mul;
if(!(target%vec[vIndex])){

for(VecIndex vi=0; vi for(VecIndex vc=0; vc cout<< vec[vi] <<
(共0页)