Click to See Complete Forum and Search --> : Trick Question apple/orange/watermelon


tomleo16
March 16th, 2011, 12:23 AM
Don't know whether this is the right place to ask. Somebody ask me this and i can't figure it out.

anyone?

1 apple= 10 cent
1 orange = 30 cent
1 watermelon =$7

How do i buy 100 items for $100

alanjhd08
March 16th, 2011, 05:31 AM
Hi,

You can write that as a linear diophantine equation, then google for solutions.

Alternatively, ask whether you can buy the melon in slices.

Alan

Philip Nicoletti
March 16th, 2011, 05:56 AM
Personnaly, I could not eat 12 watermelons.

alanjhd08
March 16th, 2011, 06:08 AM
At those prices though, if you don't get those 12 watermelons you'll end up with a lot of apples & oranges, could be even more difficult to get through. Even 52 apples is a lot for one person, I think a fruit salad is the best plan.

tomleo16
March 16th, 2011, 08:07 AM
Kind of frustrating when this question is lingering on mind.

In terms of programming or in terms of maths,i can't really figure it out.

Philip Nicoletti
March 16th, 2011, 10:48 AM
Solve it like any other "word problem" in algebra ...


let x = number of apples
let y = number of oranges
let z = number of watermellons

Equations:

(eq 1) : x + y + z = 100
(eq 2) : 0.10*x + 0.30*y + 7.00*z = 100

Other restrictions:

(r 1) : 0 <= x <= 100
(r 2) : 0 <= y <= 100
(r 3) : 0 <= z <= 100
(r 4) : x , y, and z must be integers


For ease : multiply both sides of (eq 2) by 10

(eq 1) : x + y + z = 100
(eq 2) : x + 3*y + 70*z = 1000

2 equations ... 3 unknowns

solve for x in (eq 1) and substitute into (eq 2)

(eq 1) : x = 100 - y - z
(eq 2) : (100-y-z) + 3*y + 70*z = 1000

simplify (eq 2)

(eq 2) : 2*y + 69*z + 100 = 1000

solve for y in equation 2

(eq 2) : y = (900 - 69*z) / 2

brute force :

set z = 0 ... yields y = 450 (too big)
set z = 1 ... yields y = 415.5 (too big and not an integer)
set z = 2 ... yields y = 381 (too big)
set z = 4 ... yields y = 312 (too big)
set z = 6 ... yields y = 243 (too big)
set z = 8 ... yields y = 174 (too big)
set z = 10 ... yields y = 105 (too big)
set z = 12 ... yields y = 36

check :

z = 12 , y = 36 ---> x = 52 (from eq 1)

eq 2 : 52 + 3*36 + 12*70 must equal 1000

tomleo16
March 17th, 2011, 12:29 AM
-U r a genius-