At a police line-up a witness to a crime sought to identify a criminal from among four men. The witness looked for a man who was not tall, not fair, not skinny, and not good-looking; though looking for any of these characteristics may not have been valid.
In the line-up:
1. Four men each stood next to at least one tall man.
2. Exactly three men each stood next to at least one fair man.
3. Exactly two men each stood next to at least one skinny man.
4. Exactly one man stood next to at least one good-looking man.
Of the four men:
5. The first man was fair, the second man was skinny, the third man was tall, and the fourth man was good-looking.
6. No two men have more than one characteristic - tall, fair, skinny, good-looking - in common.
7. Just one man had more than two looked-for characteristics, i.e. not tall, not fair, not skinny, not good-looking; this man was identified as the criminal by the witness.
Which man-first, second, third or fourth-was identified as the criminal by the witness?
CLS
FOR t1 = 0 TO 1
t(1) = t1
FOR t2 = 0 TO 1
t(2) = t2
FOR t3 = 0 TO 1
t(3) = t3
FOR t4 = 0 TO 1
t(4) = t4
FOR f1 = 0 TO 1
f(1) = f1
FOR f2 = 0 TO 1
f(2) = f2
FOR f3 = 0 TO 1
f(3) = f3
FOR f4 = 0 TO 1
f(4) = f4
FOR s1 = 0 TO 1
s(1) = s1
FOR s2 = 0 TO 1
s(2) = s2
FOR s3 = 0 TO 1
s(3) = s3
FOR s4 = 0 TO 1
s(4) = s4
FOR g1 = 0 TO 1
g(1) = g1
FOR g2 = 0 TO 1
g(2) = g2
FOR g3 = 0 TO 1
g(3) = g3
FOR g4 = 0 TO 1
g(4) = g4
good = 1
FOR i = 1 TO 4
IF t(i - 1) = 0 AND t(i + 1) = 0 THEN good = 0
NEXT
fct = 0
FOR i = 1 TO 4
IF f(i - 1) = 1 OR f(i + 1) = 1 THEN fct = fct + 1
NEXT
IF fct <> 3 THEN good = 0
sct = 0
FOR i = 1 TO 4
IF s(i - 1) = 1 OR s(i + 1) = 1 THEN sct = sct + 1
NEXT
IF sct <> 2 THEN good = 0
gct = 0
FOR i = 1 TO 4
IF g(i - 1) = 1 OR g(i + 1) = 1 THEN gct = gct + 1
NEXT
IF gct <> 1 THEN good = 0
IF good THEN
IF f1 AND s2 AND t3 AND g4 THEN
FOR i = 1 TO 4
FOR j = 1 TO 4
IF i <> j THEN
comct = 0
comct = comct + (t(i) AND t(j))
comct = comct + (f(i) AND f(j))
comct = comct + (s(i) AND s(j))
comct = comct + (g(i) AND g(j))
END IF
IF comct > 1 THEN good = 0
NEXT
NEXT
IF good THEN
PRINT t1; f1; s1; g1, t2; f2; s2; g2, t3; f3; s3; g3, t4; f4; s4; g4
END IF
END IF
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
The program accounts for items 1 through 6. We look for item 7 by inspection of the output.
With headings added to the program's output we get:
Man 1 Man 2 Man 3 Man 4
T F S G T F S G T F S G T F S G
0 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1
0 1 0 0 1 0 1 0 1 1 0 0 0 1 1 1
0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0 1 0 0 0 0 0 1 1
0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1
with T, F, S and G standing for tall, fair, skinny and good-looking respectively.
In all these scenarios, man 1 has more than two of the desired lack of these characteristics, and in the first two cases is indeed the only one with these three lacks.
Man 1 was the one identified.
|
Posted by Charlie
on 2014-01-08 16:08:35 |