A person wants to withdraw X rupees and Y paise from the bank. But the cashier made a mistake and gave him Y rupees and X paise. Neither the person nor the cashier noticed that. After spending 20 paise, the person counts the money. And to his surprise, he has double the amount he wanted to withdraw. Find X + Y .
Assumptions
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
it takes a lot of time to guess the answer by hit and trial ......... is there any other way to find it
Log in to reply
its the way we solve simple Diophantine Equations. I have only this idea. Please see alternate solutions posted below .
for(int i=0;i<100;i++) for(int j=0;j<100;j++) if(199 i-98 j==-20) cout<<i<<" "<<j<<endl;
2(x 100+y)=y 100+x-20
200x+2y=100y +x-20
98y-199x= 20
x & y should be integers.
x=26 & y=53 is the only answer to satisfy the above two conditions
Therefore, X+Y = 53+26
=79
How did you compute the value of x and y from 98y-199x=20 alone? :o
This can be solved by Diophantine equations. But there is a much simpler way---
Note that after spending 20 paise, the person has left 2x+2y. The change that he has left, from the x paise given him by the cashier, will be x-5.
We know that y is less than 100, but we do not know yet whether it is less than 50 paise. If it is less than 50 paise, we can write the following equations:
2x=y
2y=x-5
If y is 50 paise or more, then the person will be left with an amount of paise (2y) that is a rupee or more. We therefore have to modify the above equations by taking 100 from 2y and adding 1 to 2x. The equations become:
2x+1=y
2y-100=x-5
Solving the set of simultaneous equations gives us the solution.The first set gives x a minus value, which is ruled out. The second set gives the correct values.
x= 26 y= 53
He wanted X rupee and Y paise. Converting this to one unit, he wanted 100
X+Y paise.
He actually received Y rupee and X paise. Converting this to one unit, he received 100
Y + X paise. After spending money, he was left with 100
Y+X-20 paise, which is twice what he wanted. So:
100
Y+X-20 = 2(100
X+Y)
100Y+X-20 = 200X+2Y
98Y=199X+20
This looks like 1 equation with 2 variables, so we need to consider additional constraints. X and Y must be integers, since it wouldn't make sense to have a fractional paise. So let's look at an example and go from there.
IF X=1, RHS = 199+20 --> Y = (199+20)/98, which is not an integer. But looking at this example, we may deduce that Y is an integer iff 199X+20 = 0mod98. Rather than think about mods, let's use a couple points.
Consider X = 1, 199
1 + 20 = 23mod98.
Consider X = 2, 199
2 + 20 = 26mod98.
Consider X = 3, 199
3 + 20 = 29mod98. It looks like an arithmetic sequence with initial term 23 and common difference 3.
Since it's purely increasing, to find 0mod98, we find 98mod98.
So 98 = 20+3*X --> X = 26. So we have X, we just plug back into our 98Y = 199X + 20 to find Y = 53
26 + 53 = 79.
Step 1: Convert rupees to paise
=> Want: 100X + Y
Get: 100Y + X
After spend: 100Y + X -20 = 200X + 2Y (After spend = 2 want)
=> Equation: 98Y -199X = 20 (1)
Step 2: This part is a bit tricky and i might not explain it well (since i ain't study math in English)
We see that 98 x 2 - 199 = -3 (which mean Y =2 and X = 1)
=> (98 x 2 - 199) x N = (-3) x N = A
98 = 20 +78
Now what we want is to eliminate 78
=> 78 + A = 0
=> (-3) x N = -78
=> N = 26
Step 3 Now back to equation (1)
=> A + 98 = 20 (as said above 78 + A = 0)
=> (-3) x N + 98 = 20
=> (98 x 2 - 199) x N + 98 = 20
and with N = 26 as prove above
=> 98 x 2 x 26 - 199 x 26 + 98 = 20
=> X= 2 x 26 + 1 = 53
Y = 26
=> X + Y = 26 + 53 = 79
There are many integer solutions to this: (26,53),(124,252), (222,451),(320,650)....and so forth.
But paise can not be above 100 so there is only one answer.
Problem Loading...
Note Loading...
Set Loading...
Form equation : 199 X - 98 Y= - 20 [First convert rupees to paise]
Now Find integral Solutions to this equation, i.e. X=26 , Y=53.