Calculating a formula for variables with multiple values equaling the same total

193 Views Asked by At

I'm having a bit of trouble puzzling a formula for some code I'm using to develop a piece of software. I'm not very savvy with what the technical terms for all of what I'm describing are, but I'll try to be thorough in my explanation.

x and y need to be put into a formula that equals 100, and can be used as many times in the formula as necessary

x and y have multiple values

the values of x and y are paired, so they need to be in order. You can't take the fifth x value and use it with the third y value.

the x values are, in order, 10, 20, 25, 30, 40, 50, 55, 60, 75

the y values are, in order, 1, 2, 3, 4, 5, 6, 7, 8, 9

For example, x = 20 would pair with y = 2.

So far, I've been trying 10(x/y) + (15 - y), but that's rather stupid now that I think about it. With x = 20 and y = 2, the answer would be 113, whereas with x = 75 and y = 9, the answer is 89.

The answer to all nine pairs of variables needs to total 100. I've been doing these sorts of formulas all day but this is the first one I've had trouble with... maybe because my brain is fried. But I would dearly appreciate the answer soon, otherwise I would've been content to stop working for the day and unclog my mind.

If anyone could offer assistance or even lead me in the right direction to solving this quandary, I would be very thankful.