The professions of Mr. Miller, Mr. Painter, Mr. Treasurer and Mr. Hunter are: a miller, a painter, a treasurer and a hunter. However, none of them has a name identifying their profession. They made four statements:
- Mr. Miller is the hunter
- Mr. Treasurer is the miller.
- Mr. Painter is not the hunter.
- Mr. Hunter is not the painter.
According to those statements, the painter must be Mr. Painter, but this cannot be correct. Three of the four statements are false.
Who is the treasurer?
DECLARE SUB permute (a$)
a$ = "mtph": h$ = a$
ct = 0
IF MID$(a$, 1, 1) = "h" THEN ct = ct + 1: t = 1
IF MID$(a$, 2, 1) = "m" THEN ct = ct + 1: t = 2
IF MID$(a$, 3, 1) <> "h" THEN ct = ct + 1: t = 3
IF MID$(a$, 4, 1) <> "p" THEN ct = ct + 1: t = 4
good = 1
FOR i = 1 TO 4
IF MID$(a$, i, 1) = MID$(h$, i, 1) THEN good = 0: EXIT FOR
IF ct = 1 AND good = 1 THEN PRINT a$, t
LOOP UNTIL a$ = h$
where the initials of the surnames are in the heading and the initials of the professions are below. The column on the right states which statement is true for that set.
In all cases, the treasurer is Mr. Miller, though the other professions vary.
Posted by Charlie
on 2013-12-11 16:10:40