maths prob
- trayhop123
- Senior Member
- Posts: 4901
- Joined: Tue Jan 22, 2008 9:21 pm
- Location: leicester
maths prob
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)
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)
Little discipline = BIG issue
**** ****
**** ****
- trayhop123
- Senior Member
- Posts: 4901
- Joined: Tue Jan 22, 2008 9:21 pm
- Location: leicester
- trayhop123
- Senior Member
- Posts: 4901
- Joined: Tue Jan 22, 2008 9:21 pm
- Location: leicester
- trayhop123
- Senior Member
- Posts: 4901
- Joined: Tue Jan 22, 2008 9:21 pm
- Location: leicester
-
- Senior Member
- Posts: 225
- Joined: Fri Apr 20, 2007 1:02 pm
I, on the other hand, cheated like a bastard, and wrote this:
...an appalling brute-force solution, but it's what I'd've done in my head anyway.
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);
}
}
}
}