Four sisters, Sandra, Olivia, Natalie, and Dakota, were each born in a different one of the following months: September, October, November, and December.
"This is terrible," said Olivia one day. "None of us have an initial that matches the initial of her birth month."
"I don't mind at all," replied the girl who was born in September.
"That's easy for you to say," said Natalie. "I would at least have been pleased if the initial of my birth month was a vowel, but no."
In which month was each girl born?
clearvars,clc
months='SOND';
sisters='SOND';
sisOrds=perms(sisters);
for i=1:length(sisOrds)
sisOrd=sisOrds(i,:);
if (sisOrd==months)==zeros(1,4)
if sisOrd(1)~='O';
if sisOrd(1)~='N'
if sisOrd(2)~='N'
disp(sisOrd)
end
end
end
end
end
finds
DSON
Dakota was born in September
Sandra was born in October
Olivia was born in November
Natalie was born in December
as
the September birthday was not Olivia.
Natalie was born in neither September nor October.
That leaves only the given order among orders that match no names with the corresponding months.
|
Posted by Charlie
on 2023-08-05 11:27:08 |