Six brothers Al, Bob, Cal, Don, Elmer and Fred always take the same seat when they have their meals in the circular dinner table. The following figure displays their seat numbers.
1
6 2
5 3
4
The following is known:
- Bob's seat number is precisely 1 larger than that of Elmer's seat number.
- The seat of Don is separated from Al's seat by precisely one of the other brothers.
- Al's seat number is either 1 larger than or 1 smaller than Fred's seat number.
- The absolute difference of Cal's seat number from that of Bob's and the absolute difference of Cal's seat number from that of Don's are respectively either, 2 and 5; or, 5 and 2.
Determine the respective seat numbers of the six brothers.
I used the following code
CLS 0
FOR a = 1 TO 6
FOR b = 1 TO 6
IF b <> a THEN
FOR c = 1 TO 6
IF c <> b AND c <> a THEN
FOR d = 1 TO 6
IF d <> a AND d <> b AND d <> c THEN
FOR e = 1 TO 6
IF e <> a AND e <> b AND e <> c AND e <> d THEN
FOR f = 1 TO 6
IF f <> a AND f <> b AND f <> c AND f <> d AND f <> e THEN
IF b = e + 1 THEN
IF ((d + 1) MOD 6) + 1 = a OR ((a + 1) MOD 6) + 1 = d THEN
IF ABS(a - f) = 1 THEN
IF (ABS(c - b) = 2 AND ABS(c - d) = 5) OR (ABS(c - b) = 5 AND ABS(c - d) = 2) THEN
PRINT "Al is in seat " + STR$(a)
PRINT "Bob is in seat " + STR$(b)
PRINT "Cal is in seat " + STR$(c)
PRINT "Don is in seat " + STR$(d)
PRINT "Elmer is in seat " + STR$(e)
PRINT "Fred is in seat " + STR$(f)
END IF
END IF
END IF
END IF
END IF
NEXT f
END IF
NEXT e
END IF
NEXT d
END IF
NEXT c
END IF
NEXT b
NEXT a
and got the following solution
Al is in seat 4
Bob is in seat 3
Cal is in seat 1
Don is in seat 6
Elmer is in seat 2
Fred is in seat 5
|
Posted by Daniel
on 2009-05-25 14:35:08 |