I need to keep a set of five elements [a:b:c:d:e] in a ratio of [2:1:3:2:1].
I have a collection of [2035, 1050, 3060, 2040, 1027].
I need to take maximum amount of the elements according to ratio and keep the rest separately.
ELEMENT | RATIO | TOTAL Collection | RATIO WISE QTY | REMAINDER |
---|---|---|---|---|
a | 2 | 2035 | ? | ? |
b | 1 | 1050 | ? | ? |
c | 3 | 3060 | ? | ? |
d | 2 | 2040 | ? | ? |
e | 1 | 1027 | ? | ? |
ELEMENT | RATIO | TOTAL COLLECTION | RATIO WISE QTY | REMAINDER |
---|---|---|---|---|
a | 2 | 2035 | 2034 | 1 |
b | 1 | 1050 | 1017 | 33 |
c | 3 | 3060 | 3051 | 9 |
d | 2 | 2040 | 2034 | 6 |
e | 1 | 1027 | 1017 | 10 |
How can I build an algorithm to get the last two column value from the first three columns.