Hello guys, seems like I'm making a habit of asking questions these days.

I'm busy making an automatic exam generator, whereby I input details about the exam, then the questions and so on. It is basically at a stage where I could already implement it, but there is a feature I'd like to include, and by doing that, will make the application more user friendly.

Let me explain. If have used / seen Microsoft Excel's Solver utility, you'd know that I can tell Solver that I'm working with x amount ( say, 500000 ), and I need to buy at least 2 big cars, 3 medium cars, and 4 small cars with that 500000. Right, so now I can set Solver's constraints in order to achieve that. It show me that I can buy 10 small cars, 6 medium cars, and 6 big cars. If I were to change the original total to 490 000, it will show me that I can buy 5 small cars, 7 medium cars, and 7 big cars.

So now, I think I'm looking for something similar to this. Basically, I need to be able to input 50 ( the theory section's total marks ), and be able to generate an automatic point scheme, with questions counting 2 marks, 3, 4, 5, and 1. I need to be able to give all available possibilities and have used all marks. Understand what I mean ¿

For example, if I take 25 as a total, I can have 6 questions counting 2 marks, 1 question counting 5 marks, 1 question counting 3, and another question counting 4. I need to have more than one option.

Is there such a formula which will enable me to do this ¿
Any advice would be appreciated!