# How Will You Get 100 Fruits in Rs.100?

For Rs. 0.5 you get 1 Cherry.

For Rs.3 you get 1 Orange.

For Rs.5 you get 1 Watermelon.

Your mother told you to get 100 fruits for Rs.100.

Condition: You have to get at least one of each fruit.

• Is this a puzzle you invented? (If not, could you provide a source?) – puzzledPig Mar 6 '18 at 2:45
• It's a puzzle of Bengali source, bissoy.com/720699. And the question is its translation. – IQ WANTER Mar 6 '18 at 2:47
• @IQWANTER You should add your source to the question itself. Comments are ephemeral and the source may be lost in time due to their nature. – Brian J Mar 6 '18 at 14:18
• @IQWANTER edited to clarify what you mean by condition. If I got it wrong, please feel free to edit further – Kevin Mar 6 '18 at 19:09

There is two solutions for your problem.

84c, 11o, 5w or 88c, 2o, 10w

How do we come up with these answers. It's a simple math problem + little logic. First we create these two equations that represents our problem:

$x+y+z = 100$ and ($0.5x+3y+5z = 100$ or $x+6y+10z=200$ (for simplicity))
Isolate $x$ for $x+y+z=100$ => $x=100-y-z$ Substitute $x=100-y-z$ => $100-y-z+6y+10z=200$
Isolate $y$ for $100-y-z+6y+10z=200$ => $y=(-9z+100)/5$

Now:

For $x=100-y-z$
Substitute $y=(-9z+100)/5 - z$ => $x=4z/5 + 80$

So the solution of the system of equations are:

$y=(-9z+100)/5$ and $x=4z/5 + 80$

So all what is left to do is to

Find $z$ where $y$ and $x$ are both positive and natural numbers.
Looking at $x$, $z$ need to be a multiplier of 5 to get a natural number, so we test it with 5,10,15,etc...
When we test the 15, $y$ becomes negative. So the only solutions are that $z$ is equal to 5 and 10.
Again, your problem has two solutions: 84c, 11o, 5w or 88c, 2o, 10w

We can buy the fruit in two ways:

(88c, 2o, 10w) or (84c, 11o, 5w)

Method:

These are Linear Diophantine equations in 3 variables, so we need to deduce additional constraints based on the fact that the solutions are positive integers.

0.5x + 3y + 5z = 100

and

x + y + z = 100

where x,y,z are the number of Cherries, Oranges, and Watermelons respectively. Clearly, since there is at least one of each fruit,

based on the first equation, x is between 2 to 92, y is in the range [1,31] and z[1,19] because, for example, 20 watermelons would cost Rs. 100 and leave no room for other fruits.

To eliminate x, we can multiply the first equation by 2 and subtract the second

x + 6y + 10z = 200
x + y + z = 100
-------------------
5y + 9z = 100

Dividing by 5,

y = 20 - 9z/5

Now, knowing that y is a positive integer, the 9z/5 term must produce an integer, and that integer must also be less than 20. That means z must be divisible by 5. But the only such values z can take in the range [1,19] are (5, 10, 15). 15 clearly produces a negative y, so the solutions for z are 5 and 10, producing y as 11 and 2.
Finally subtract y+z from 100 to get x as 88 and 84.

First of all, let's

decrease all the prices by one rupee/fruit. So now your goal is to buy 100 fruit with total cost zero; and the costs are -1/2 per cherry, 2 per orange, 4 per watermelon.

Now we can

identify some combinations that add up to zero: four cherries and one orange, or eight cherries and one watermelon.

At this point

we notice that we can just take 20 lots of (4 cherries + 1 orange) and we're done.

for some less convenient number than 100, one approach would have been to try to make that number out of 5s and 9s. So e.g. if we needed 50 fruit for Rs.50, we could have done it with five lots of (8C+1W) and one of (4C+1O): total 44 cherries (Rs.22) + 1 orange (Rs.3) + 5 watermelons (Rs.25).

You may notice

that we could take that solution and double it to get another solution to the 100/100 problem as posed. The answer is far from unique.

• The Question says we have to take all the fruits. Your solution is missing one fruit. – Sid Mar 6 '18 at 5:58
• @Sid it was edited to say that 25 minutes after Gareth answered. – boboquack Mar 6 '18 at 6:10
• I remark that my answer -- which was indeed written before that condition was added -- does give a solution that uses all the fruits. – Gareth McCaughan Mar 6 '18 at 10:27

One way is:

80 cherries + 20 orange. OP Edited to require all fruits, so:
84 cherries, 11 oranges, 5 watermelons, OR
88 cherries, 2 oranges, 10 watermelons.

Think of it this way:

First, buy all cherries. You get 200 cherries with Rs. 100, meaning 200 fruits. You need to reduce the number of fruits by 100, while not changing the money you spend.

An orange is 6x the price of a cherry.
That means you can exchange 6 cherries for 1 orange, causing the total fruit to be reduced by 5 without changing the amount of money you spend.

Normally i would do the same with watermelon, but without even checking watermelon, you can already see that 100 is divisible by 5 - meaning that, by repeatedly exchanging 6 oranges with 1 cherry (20 times, to be exact), you can reach 100 fruits with Rs.100.

200 cherries + (20 x (1 orange - 6 cherries)) = 80 cherries + 20 oranges.

Since OP has specified that we need one of each fruit now..

Likewise, you can change 10 cherries for 1 watermelon, reducing total fruit by 9 without changing the number of money spent.

Now we just need to figure out how to remove 100 fruits with those operations, i.e. removing 5 or 9 fruits at a time. We can see that there are 2 ways:

11x(5) + 5x(9) (swapping 11 oranges and 5 watermelons for 116 cherries), or
2x(5) + 10x(9) (swapping 2 oranges and 10 watermelons for 112 cherries)

Through those we are able to get a total of either:
84 cherries, 11 oranges, 5 watermelons, OR
88 cherries, 2 oranges, 10 watermelons.
which both works.

First, I don't like working with fractions. So I would define a new currency worth .5 RS. Now the prices are 1,6,10, and the total money is 200.

Next, I know that the first three purchases will be 1 cherry, 1 orange, 1 watermelon. So I can simplify the problem to trying to decide what the next 97 purchases will be with the 183 remaining. I know that each purchase will cost at least 1, so I will spend at least 97.

Each cherry I buy adds 0 to this amount (that is, if I buy only cherries, I will add 0 to 97, and get a total of 97), each orange adds 5, and each watermelon adds 9. I know I have to add 86 to 97 to get 183. So I now know that I need to have 5*oranges+9*watermelons = 86.

If you're confused by this, I'm just rewriting the equation

1*cherries+6*oranges+10*watermelons = 183

as

(1+0)*cherries+(1+5)*oranges+(1+9)*watermelons = 183

then rewriting that as

(cherries+oranges+watermelons)+0*cherries+5*oranges+9*watermelons = 183.

I can then take the equation

cherries+oranges+watermelons = 97

and subtract that from both sides and get

5*oranges+9*watermelons = 86

Since 86 is 5 more than a multiple of 9, that leads to the solution oranges = 1, watermelons = 9.

Since 5*9=9*5, I can subtract 5 from the number of watermelons and add 9 to the number to the number of oranges to get another solution, oranges = 10, watermelons = 4.

Now I just have to add back the three fruit (note that it's "fruit", not "fruits") that I bought at the beginning. So the solutions are oranges = 2, watermelons = 10 or oranges = 11, watermelons = 5. Finding the number of cherries is a simple matter of seeing how many remain. For the first solution, that's 100-2-10 =88; for the second solution, it's 100-11-5=84. So the solutions are:

cherries = 88, oranges = 2, watermelons = 10 and
cherries = 84, oranges = 11, watermelons = 5

• Breaking up the wall of text might help make it more readable. – Lawrence Mar 6 '18 at 17:59
• @Lawrence Yeah, I'm still figuring out how to make spoilers would nicely with line breaks. – Acccumulation Mar 6 '18 at 19:30
• Yeah, those are tricky. I think you need to use inlined markup for line breaks. Double backslashes? – Lawrence Mar 7 '18 at 1:13
• @Acccumulation Add two spaces at the end of each line. Take a look at Votbear's answer for an example. – F1Krazy Mar 7 '18 at 10:06
• @Acccumulation I find it easiest to just type it all out inside the spoiler and put <br>(s) where the line break(s) should go. – Chowzen Mar 19 '18 at 16:28