A distant planet is inhabited by creatures having more than two arms. The ones with an even number of arms are the knights who always tell the truth; the ones with an odd number of arms are the liars who always speak falsely.
The rules of the planet allow only creatures having eight, nine or ten arms to work as guards. Four guards were conversing amongst themselves:
- The amber one said, "The azure one and I have 19 arms together."
- The azure one said, "The jade one and I have 18 arms together."
- The jade one said, "The ivory one and I have 18 arms together."
- The ivory one said, "The amber one and I have 19 arms together."
How many arms does each guard have?
FOR amber = 8 TO 10
FOR azure = 8 TO 10
FOR jade = 8 TO 10
FOR ivory = 8 TO 10
ambaz = amber + azure
jadaz = jade + azure
ivjad = jade + ivory
ambiv = amber + ivory
good = 1
IF (amber = 9) <> (ambaz <> 19) THEN good = 0
IF (azure = 9) <> (jadaz <> 18) THEN good = 0
IF (jade = 9) <> (ivjad <> 18) THEN good = 0
IF (ivory = 9) <> (ambiv <> 19) THEN good = 0
IF good THEN
PRINT amber; azure; jade; ivory
END IF
NEXT
NEXT
NEXT
NEXT
finds that the respective numbers of arms on
Amber, Azure, Jade and Ivory are:
9 9 8 10
|
Posted by Charlie
on 2012-09-04 10:53:59 |