Page 1 of 1
maths prob
Posted: Mon Feb 25, 2008 3:17 pm
by trayhop123
ok work this out .....not a trick question ,,, genuine answer to follow in a day or two.
you have 200quid your off to the fruit shop ( quite apt for this site lol )
anyway lets see
grapes = 5p
melons = 1 quid
plums = 5 quid
now u must spend exactly 200quid and you must come back with exactly 200fruit
the only rule is you must have at least 1 of each fruit ( so you cant be a clever twat and just buy 200 melons lol)
will post the solution in a few days if nobody gets it. good luck
STOP PRESS ( THIS HAS BEEN ANSWERD BELOW SO DONT SCROLL DOWN IF YOU DONT WANNA CHEAT)
Posted: Mon Feb 25, 2008 3:28 pm
by Mr Bubbles
hidden as requested
Posted: Mon Feb 25, 2008 3:33 pm
by trayhop123
feck me that wer fast well done ...........now edit ya post and let someone else have a crack
Posted: Mon Feb 25, 2008 3:35 pm
by gambogaz1
If you new his profession you wouldn't be so surprised.
Posted: Mon Feb 25, 2008 3:36 pm
by Istenem
are the plums made out of solid gold?
Posted: Mon Feb 25, 2008 3:36 pm
by Weyland
I found another:
Plums: 38
Melons: 2
Grapes: 160
I think there's only the two solutions.
Posted: Mon Feb 25, 2008 3:37 pm
by Drpepper
I was originally going to try and solve it as a linear programming problem then i realised trial and error would probably be quicker, and by then i was beaten
.
Posted: Mon Feb 25, 2008 3:57 pm
by trayhop123
and posted as promised mr bubs got it first ,,,,,,,, but now im intrigued by gazs comment what r u then ,,,,,maths professor ?????
Posted: Mon Feb 25, 2008 4:03 pm
by trayhop123
laughs at drpepper ......... i openly admit i was told the answer ..... couldn't work it out myself....
Posted: Mon Feb 25, 2008 4:05 pm
by Mr Bubbles
trayhop123 wrote:and posted as promised mr bubs got it first ,,,,,,,, but now im intrigued by gazs comment what r u then ,,,,,maths professor ?????
LOL,
I work as a accountant for a living, as the numbers were easy on the eye (i.e 1's & 5's) I simply worked it out by trial & error.
Posted: Mon Feb 25, 2008 4:11 pm
by Weyland
I, on the other hand, cheated like a bastard, and wrote this:
Code: Select all
unsigned int p, m, g;
for(p = 1; p <= 200; p++)
{
for(m = 1; m <= 200; m++)
{
for(g = 1; g <= 200; g++)
{
if(((p + m + g) == 200) &&
(((p * 500) + (m * 100) + (g * 5)) == 20000))
{
printf("p == %d, m == %d, g == %d\n", p, m, g);
}
}
}
}
...an appalling brute-force solution, but it's what I'd've done in my head anyway.