A family of four - Mr. & Mrs. Delon, their daughter Amelia, and their son Liam - went out to dinner. They each had a different meat, potato, and vegetable.
- The meats were either steak, ham, chicken, or lamb.
- The potatoes were either baked, mashed, french fried, or boiled.
- The vegetables were peas, carrots, corn, or spinach.
The following facts are known:
- One child had lamb and the other french fried potatoes.
- One of the females had spinach and the other chicken.
- Mr. Delon sat on the right of the person who had corn, who sat on the right of the person who had chicken, who sat on the right of the person who had baked potatoes, who sat on the right of the person who had peas.
- One parent had boiled potatoes and the other steak.
- One of the males had steak and the other had french fried potatoes.
From the clues given above, determine the meal eaten by each member of the family.
clearvars,clc
idents=perms('fmds');
meats=perms('shcl');
potatos=perms('bmfp');
vegies=perms('pcms');
lim=length(idents);
for id=1:lim
ident=idents(id,:);
for mt=1:lim
meat=meats(mt,:);
for pot=1:lim
potato=potatos(pot,:);
for veg=1:lim
vegie=vegies(veg,:);
ix=find(meat=='l' | potato=='f');
who=sort(ident(ix));
if ~isequal(who,'ds')
continue
end
ix=find(meat=='c' | vegie=='s');
who=sort(ident(ix));
if ~isequal(who,'dm')
continue
end
ix=find(meat=='s' | potato=='p');
who=sort(ident(ix));
if ~isequal(who,'fm')
continue
end
ix=find(meat=='s' | potato=='f');
who=sort(ident(ix));
if who~='fs'
continue
end
MrD=find(ident=='f');
corn=find(vegie=='m');
chicken=find(meat=='c');
baked=find(potato=='b');
peas=find(vegie=='p');
if MrD==peas
if mod(MrD-corn,4)==1 ...
&& mod(corn-chicken,4)==1 ...
&& mod(chicken-baked,4)==1 ...
&& mod(baked-peas,4)==1 ...
&& mod(corn-chicken,4)==1
disp(ident)
disp(meat)
disp(potato)
disp(vegie)
disp([MrD corn chicken baked])
disp(' ')
end
end
end
end
end
end
shows
sfdm identities by family relationship
hslc meat
fmbp potatos
mpsc vegetable
2 1 4 3 positions
dmsf
lchs
bpfm
scmp
4 3 2 1
msfd
chsl
pfmb
cmps
3 2 1 4
fdms
slch
mbpf
pscm
1 4 3 2
which are all really the same with the table rotated differently.
The father ate steak, mashed potatos and peas.
The daughter ate lamb, baked potatos and spinach.
The mother ate chicken, boiled potatos (p for peeled), and carrots.
The son ate ham, french fries and corn (m for maize).
|
Posted by Charlie
on 2023-03-13 14:37:00 |