At the local sweet shop, three particularly nice sweets are on special offer. A Sparkle, a Wibbler and a Nobbler together cost 40p. A Nobbler is over three times the price of a Sparkle. Six Sparkles are worth more than a Wibbler. A Nobbler, plus two Sparkles costs less than a Wibbler. Can you determine the price of each type of sweet?

i couldn’t help myself, i looked for google for some brain teasers, and i liked this one. maybe i need to look for a really challenging ones, this one is pretty easy, u get it after 3rd or 4th try

23 13 4

but wanna ask, did u use a systematic method or just worked it out randomely, I mean using ur thinking abilites only? I used a combination of both! it is easy, but hey, lets try to solve it using a computer program, can u? object oriented language, not logic one ðŸ˜‰

tell me, because I did not study algorithems, u remember that day we were talking about PHD and Algorithems?

well, i don’t think it is that hard to make a program that try all possible combinations. by the way , this method is called brute force. but of course this method is the least realistic for use in general puzzle questions

but if we are to think of a smart method to do it, hmmmmmm, i guess combinging and three comparisons in the quesiton should be able to reduced to a single range for each sweet.

i did like u did, both, i put the main three comparisons, start putting arbitrary cost for sparkles and then i try to satisfy the sparkles rule by adding 1 to the cost of 3 sparkles to get the nibbler and try the last 2 comparisons to see if it worked. this method is more of trial and error, but really i think we can reduce the comparisons into a spcefic answer, u know what..i will try it now, so i will pause this comment.

….

….

…

…

…

yeeeeeeeeesssssssssssss, i did it, and apparenlty it was harder than i expected. it took a good 10-15 minutes.

Here are the equations, sparkles is S, nibbler is N and wibbler is W.

the equations we have are:

1)S + N + W = 40

2)3S < N

3)W < 6S

4)N + 2S < W

the first part:

12S + 12N + 12W = 480 // Eq1) *12

12W + 2W + 12N < 480 // subsituting by Eq3)

14W + 36S < 480 // substituting by Eq2)

20W < 480 // substitute Eq3)

W <24

second part: 480 // substitute by Eq4)

if we rearrnage Eq4) we get Eq5)N 480 // substitute by Eq5)

5/12*(24W – 12S) > 5/12*(480) // multiply by 5/12

10W – 3S – 2S > 200 // just did the multi and parted 5S

10W – N – 2S > 200 //subs by Eq2)

9W > 200 // subs by Eq4)

W > 22.2222222

so 22.2222 < W < 24 so W is 23

i didn’t do the rest, but it is much easier from here.

it took much longer in the second part because i can’t substitute things with less value, like i can’t substittue 6S with W because W worth less, and if i put it on the bigger part of the comparison, i can’t gaurntee it won’t change the sign, so all my subssititues in the first part was from big to small, and the second one, from small to big this way i can keep the comparison direction

p.s: i just did this on paper, so i bet there is redundancy in my solution, but the idea is the same.

nice solution! but actually I did not use the three comparisons! I reduced them to 2 comparisons that are much easier to deal wih.

they are:

4S>N>3S

6S>W>5S

when u use it with the sum of 40, u would soon figure out that any value gr8er than 7 is impossible and then u would find that 7, 6 & 5 without trying are also impossible, and that 1,2 & 3 are impossible also without trying but just by thinking, so it is s = 4 definitely.

the trails are really reduced, and so you get it quickly. anyways, trail and error might take long time but will sure find the solution, thinking is likely to find it faster but not for granted that u would found the solution, so the hybrid method is the best I think =)