Let me start off by clarifying that(before you guys dismiss me), this is not a homework problem and I'm not a university student. :)
EDIT
Thanks to @Klas and others, my question now boils down to a mathematical equation which needs to be solved programmatically.
I'm looking for an algorithm/code which solves Linear Diophantine Equation
.
For lesser mortals like me, here's how such an equation looks like:
Example 1: 3x + 4y + 5z = 25
(find all possible values of x,y,z)
Example 2: 10p + 5q + 6r + 11s = 224
(find all possible values of p,q,r,s)
Example 3: 8p + 9q + 10r + 11s + 12t = 1012
(find all possible values of p,q,r,s,t)
I tried googling to no avail. I would have thought that some code would already be written to solve this. Do let me know if you guys have come across some kind of library which has already implemented this. And if the solution is in Java, nothing can be cooler!. Algorithm/pseudo code will also do. Thanks much.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…