The Smiths, the Andrings and the Cliffords all hold a big party. Everyone shakes hands with every member of the other two families (no one shakes hands with members of their own family), 142 handshakes in all.
Assuming that there at least as many Andrings as Smiths, and at least as many Cliffords as Andrings, how many of each family are present?
(In reply to
Solution by e.g.)
Such a program would look something like this:
tot = 8
DO
FOR a = 3 TO tot - 2
FOR b = a TO tot - 1
c = tot - a - b
IF c > 0 THEN
IF a * b + b * c + a * c = 142 THEN PRINT a, b, c
END IF
NEXT b
NEXT a
tot = tot + 1
LOOP
|
Posted by Charlie
on 2004-06-14 08:19:15 |