-4
$\begingroup$

please i am trying find algorithm for 3 months but unsuccesful, i asked my teaches of theretics informatics but unsuccesfull too.

problem. for example my Mum give me 50€ with condition -> can spend 35 - 40€ but need buy only 5 different items (different prices). I need all posibilities.

I know so problem hasn't always solution.

Please can you get me some advices? but i am desperate.

Sorry for english.

Example products prices {1,1.1,1.3,2,3,4,5,6.6,7,10} can spend 10-14.5€ need buy 4 products

solutions
1)     1, 1.1, 1.3, 7 = 10,4
2)     1,   2,   3, 4 = 10
3)   1.1,   2,   3, 4 = 10,1
3)   1.3,   2,   3, 4 = 10,2
4)     2,   3,   4, 5 = 14
5)     1, 1.1, 1.3, 10= 13,4
..
...
....

Thanks for any help


please if you have questions write here, not vote for -1..

$\endgroup$
  • $\begingroup$ Is there any reason a brute force solution would not work for you? $\endgroup$ – dkaeae Jan 24 at 15:29
  • $\begingroup$ is not effective, lot of time spend because my "products" is 50+ and its lot of options. At best i want run alghorithm on android devices not server. (it depends on complexity) $\endgroup$ – Parad0X Jan 24 at 15:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.