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

 Hotel Room Rumination (Posted on 2013-12-26)
Six people stayed in a hotel.

1. The six people were three men- Andy, Barry and Clint - and three ladies- Debra, Ellen and Francine.
2. Each stayed in a different one of six rooms arranged like this:
```+------+------+------+------+
|      |      |      |      |
|      |  2   |      |   4  |
|  1   +------+  3   |------+
|      |      |      |      |
|      |      |      |      |
+------+      +------+      |
|             |             |
|      6      |       5     |
|             |             |
+-------------+-------------+```
3. Andy said: "I stayed in a large room."
4. Barry said: "I stayed in a medium-sized room."
5. Clint said: "I stayed in a small room."
6. Exactly one man lied.
7. Of the three rooms occupied by the men, only the room occupied by the man who lied bordered on exactly two of the rooms occupied by the ladies.

Who lied?

 No Solution Yet Submitted by K Sengupta Rating: 3.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 5

DECLARE SUB permute (a\$)
CLS
DIM size AS STRING, occ AS STRING, border(6) AS STRING

size = "msmsll"

border(1) = "26"
border(2) = "136"
border(3) = "2654"
border(4) = "35"
border(5) = "436"
border(6) = "1235"

occ\$ = "abclll": h\$ = occ\$
DO
truect = 0: alie = 0: blie = 0: clie = 0
andy = INSTR(occ\$, "a")
IF MID\$(size, andy, 1) = "l" THEN truect = truect + 1:  ELSE alie = 1
barry = INSTR(occ\$, "b")
IF MID\$(size, barry, 1) = "m" THEN truect = truect + 1:  ELSE blie = 1
clint = INSTR(occ\$, "c")
IF MID\$(size, clint, 1) = "s" THEN truect = truect + 1:  ELSE clie = 1
IF truect = 2 THEN
good = 1

andylct = 0
FOR i = 1 TO LEN(border(andy))
room = VAL(MID\$(border(andy), i, 1))
IF MID\$(occ\$, room, 1) = "l" THEN andylct = andylct + 1
NEXT
IF andylct = 2 AND alie = 0 OR andylct <> 2 AND alie = 1 THEN good = 0

barrylct = 0
FOR i = 1 TO LEN(border(barry))
room = VAL(MID\$(border(barry), i, 1))
IF MID\$(occ\$, room, 1) = "l" THEN barrylct = barrylct + 1
NEXT
IF barrylct = 2 AND blie = 0 OR barrylct <> 2 AND blie = 1 THEN good = 0

clintlct = 0
FOR i = 1 TO LEN(border(clint))
room = VAL(MID\$(border(clint), i, 1))
IF MID\$(occ\$, room, 1) = "l" THEN clintlct = clintlct + 1
NEXT
IF clintlct = 2 AND clie = 0 OR clintlct <> 2 AND clie = 1 THEN good = 0

IF good THEN PRINT occ\$, alie; blie; clie
END IF
permute occ\$
LOOP UNTIL occ\$ = h\$

finds

albcll         1  0  0

meaning Andy stayed in room 1, Barry in 3 and Clint in 4.

Andy lied.

 Posted by Charlie on 2013-12-26 16:05:19

 Search: Search body:
Forums (0)