+---+-------+---+
| 1 | 2 | |
+---+---+---| 3 |
| 4 | 5 | |
+-------+---+---+
Vera,one of the performers in a play,was murdered in her dressing room. The following facts refers to the dressing rooms shown above. Each of the five performers in the play - Vera, Adam, Babe, Clay and Dawn - had his or her own dressing room.
- The killer's dressing room and Vera's dressing room border on the same number of rooms.
- Vera's dressing room borders on Adam's dressing room and on Babe's dressing room.
- Clay's dressing room and Dawn's dressing room are the same size.
- Babe's dressing room does not border on Clay's dressing room.
- The five rooms come in precisely two distinct sizes. (For example, rooms 2, 3 and 4 have the same size.)
Who killed Vera?
DATA 42,1453,25,125,423
FOR i = 1 TO 5: READ adj$(i): NEXT
DATA 1,2,2,2,1
FOR i = 1 TO 5: READ size(i): NEXT
vabcd$ = "12345": h$ = vabcd$
DO
FOR k = 1 TO 4 ' a to d
kdress = VAL(MID$(vabcd$, k + 1, 1))
vdress = VAL(LEFT$(vabcd$, 1))
IF LEN(adj$(kdress)) = LEN(adj$(vdress)) THEN
adress$ = MID$(vabcd$, 2, 1)
bdress$ = MID$(vabcd$, 3, 1)
IF INSTR(adj$(vdress), adress$) > 0 AND INSTR(adj$(vdress), bdress$) > 0 THEN
cdress = VAL(MID$(vabcd$, 4, 1))
ddress = VAL(MID$(vabcd$, 5, 1))
IF size(cdress) = size(ddress) THEN
IF INSTR(adj$(cdress), bdress$) = 0 THEN
PRINT vabcd$, MID$("ABCD", k, 1)
END IF
END IF
END IF
END IF
NEXT k
permute vabcd$
LOOP UNTIL vabcd$ = h$
finds
45132 A
as the rooms for
VABCD and the ^
respecively |
murderer
|
Posted by Charlie
on 2013-03-22 15:51:12 |