All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Alexei And Boris (Posted on 2006-03-28)
Alexei and Boris both have a whole number of chocolates, lollipops and toffees, and the product of the number of each boy's of chocolates, lollipops and toffees is 336. It is known that:

(A) Each boy has fewer chocolates than lollipops.

(B) For each boy, the product of the number of chocolates and lollipops equals the total number of candies he has.

(C) Alexei has more lollipops than toffees.

Determine the number of chocolates, lollipops and toffees possessed by each of Alexei and Boris.

 See The Solution Submitted by K Sengupta Rating: 3.0000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): Computer solution AND 7 AND 48 Comment 11 of 11 |
(In reply to re: Computer solution AND 7 AND 48 by Ady TZIDON)

Woops.  You're quite right, ADY, my mistake.  Maybe I should have had the program find the factors instead of doing it by hand.  Here's the revised program -- gives the same result.

Module Module1
Sub main()
Dim chocolates, lollipops, toffees As Integer
Dim factor() As Integer = {1, 2, 3, 4, 6, 7, 8, 12, 14, 16, 21, 24, 28, 42, 48, 56, 84, 112, 168, 336}
For i As Integer = 0 To 18
chocolates = factor(i)
For j As Integer = i + 1 To 19
lollipops = factor(j)
toffees = CInt(336 / chocolates / lollipops)
If chocolates * lollipops = chocolates + lollipops + toffees Then
Console.WriteLine(chocolates & " " & lollipops & " " & toffees)
End If
Next
Next
End Sub
End Module

 Posted by Ken Haley on 2006-03-29 23:58:58

 Search: Search body:
Forums (0)