17 lines
1 KiB
Text
17 lines
1 KiB
Text
include c:\cxpl\codes;
|
|
int B, C, F, M, S;
|
|
for B:= 1 to 4 do \Baker does not live on top (5th) floor
|
|
for C:= 2 to 5 do \Cooper does not live on bottom floor
|
|
if C#B then \Cooper & Baker live on different floors
|
|
for F:= 2 to 4 do \Fletcher doesn't live on top or bottom
|
|
if F#B & F#C & F#C-1 & F#C+1 then \ and she's not adjacent to Cooper
|
|
for M:= 1 to 5 do
|
|
if M#F & M#B & M>C then \Miller lives above Cooper
|
|
for S:= 1 to 5 do \Smith is not adjacent to Fletcher
|
|
if S#M & S#F & S#C & S#B & S#F-1 & S#F+1 then \show
|
|
[Text(0, "Baker "); IntOut(0, B); CrLf(0); \all
|
|
Text(0, "Cooper "); IntOut(0, C); CrLf(0); \possible
|
|
Text(0, "Fletcher "); IntOut(0, F); CrLf(0); \solutions
|
|
Text(0, "Miller "); IntOut(0, M); CrLf(0);
|
|
Text(0, "Smith "); IntOut(0, S); CrLf(0);
|
|
]
|