An impostor's identity is being investigated. The impostor is known to be one of three people: Andy, Barry, or Cal. The three people make the following statements:
Andy
1. Cal is the impostor.
2. Barry's first statement is true.
Barry
1. I am not the impostor.
2. Andy is the impostor.
Cal
1. Andy's second statement is true.
2. Barry's second statement is false.
However, it is known that the impostor makes one true and one false statement but the truthfulness of the other two suspects is unknown.
Who is the impostor?
DATA Andy,Barry,Cal
FOR i = 1 TO 3: READ n$(i): NEXT
FOR impost = 1 TO 3
FOR a1 = 0 TO 1
FOR a2 = 0 TO 1
FOR b1 = 0 TO 1
FOR b2 = 0 TO 1
FOR c1 = 0 TO 1
FOR c2 = 0 TO 1
good = 1
IF impost = 1 AND a1 = a2 THEN good = 0
IF impost = 2 AND b1 = b2 THEN good = 0
IF impost = 3 AND c1 = c2 THEN good = 0
IF good THEN
IF a1 <> ABS(impost = 3) THEN good = 0
IF a2 <> b1 THEN good = 0
IF b1 <> ABS(impost <> 2) THEN good = 0
IF b2 <> ABS(impost = 1) THEN good = 0
IF c1 <> a2 THEN good = 0
IF c2 = b2 THEN good = 0
IF good THEN
PRINT n$(impost), a1; a2, b1; b2, c1; c2
END IF
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT impost
finds
Andy 0 1 1 1 1 0
meaning that Andy is the imposter, whose first statement is false and second statement is true. Barry's statements are both true and Cal's first is true and second is false.
|
Posted by Charlie
on 2014-01-15 12:41:58 |