|
-
March 16th, 2011, 12:23 AM
#1
Trick Question apple/orange/watermelon
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
-
March 16th, 2011, 05:31 AM
#2
Re: Trick Question apple/orange/watermelon
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
-
March 16th, 2011, 05:56 AM
#3
Re: Trick Question apple/orange/watermelon
Personnaly, I could not eat 12 watermelons.
-
March 16th, 2011, 06:08 AM
#4
Re: Trick Question apple/orange/watermelon
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.
-
March 16th, 2011, 08:07 AM
#5
Re: Trick Question apple/orange/watermelon
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.
-
March 16th, 2011, 10:48 AM
#6
Re: Trick Question apple/orange/watermelon
Solve it like any other "word problem" in algebra ...
Code:
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
-
March 17th, 2011, 12:29 AM
#7
Re: Trick Question apple/orange/watermelon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|