Grant, Neal and Kyle just finished their lunch. One of the boys had a ham sandwich, another a turkey sandwich and the third, a chicken sandwich.
If only one of the following four statements is true, who had what for lunch?
1. Kyle had the turkey sandwich.
2. Neal did not have a chicken sandwich.
3. Kyle did not have a chicken sandwich.
4. Neal did not have the ham sandwich.
(In reply to
some thoughts by Charlie)
Well, I misread the clues: Statement 2 was not about Kyle but about Neal. Statement 2 is the true statement and Kyle had chicken, Neal had ham and Grant had turkey:
sands=perms('thc');
for i=1:length(sands)
assign=[ string(['k' sands(i,1)]),string(['n' sands(i,2)]),string(['g' sands(i,3)])];
s(1)=ismember("kt",assign);
s(2)=~ismember( "nc",assign);
s(3)=~ismember("kc",assign);
s(4)=~ismember("nh",assign);
disp(assign)
disp(s )
disp(' ')
end
"kc" "nh" "gt"
0 1 0 0 Only one is true (1)
"kc" "nt" "gh"
0 1 0 1
"kh" "nc" "gt"
0 0 1 1
"kh" "nt" "gc"
0 1 1 1
"kt" "nc" "gh"
1 0 1 1
"kt" "nh" "gc"
1 1 1 0
|
Posted by Charlie
on 2024-09-09 08:59:12 |