vendredi 26 février 2016

How to distribute a value into vector

Hi i need help to distribute a value into a vector and print all possible combination for example If a user input first value that will be the vector size input1size = 15; Then input2 is the value going to distribute inside the vector . input2 =25; 3rd input is first constant value of the vector input3 = 2 ; then this value minus input2 is the value i need to distribute inside vector

After the distribution vector look like this . When we add vector Data together the output need to be = to input2 = 25 ; and the first value is user input3;

 V1 = {2,9,2,1,1,1,1,1,1,1,1,1,1,1,1} = 25;
 V1 = {2,9,1,2,1,1,1,1,1,1,1,1,1,1,1} = 25;
 V1 = {2,9,1,1,2,1,1,1,1,1,1,1,1,1,1} = 25;
  .........
 V1 = {2,1,1,1,1,1,1,8,1,1,1,1,1,1,3} = 25;    

So on ..... and find all sequences How can i do this ...

Aucun commentaire:

Enregistrer un commentaire