All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
Ice Cream Sundae Surmise (Posted on 2022-12-11) Difficulty: 3 of 5
o Bruce, Caitlin, Felicia, and Harold went to a bar to have ice cream sundaes.

o Each of them ordered precisely two flavors from amongst the following: chocolate, vanilla, raspberry, and strawberry.

It is known that:

  1. Bruce did NOT have chocolate.
  2. Caitlin did NOT have vanilla.
  3. Felicia did NOT have raspberry.
  4. Caitlin and Felicia did NOT have any flavors in common.
  5. Two of them had strawberry.
  6. Two of them had chocolate.
  7. Three of them ordered vanilla.
  8. Harold did NOT have strawberry
  9. Caitlin had strawberry.
From the above-mentioned clues, determine the two ice-cream flavors ordered by each of the four individuals.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
Item 8 was not needed, nor used in the program:

clearvars,clc
bruce=1; caitlin=2; felicia=3; harold=4;
name=["bruce";"caitlin";"felicia";"harold"];
combo=nchoosek('cvrs',2);
n=size(combo,1);
for a=1:n
  ch(bruce,:)=combo(a,:);
for b=1:n
  ch(caitlin,:)=combo(b,:);
for c=1:n
  ch(felicia,:)=combo(c,:);
for d=1:n
  ch(harold,:)=combo(d,:);

  if ~ismember('c',ch(bruce,:)) && ~ismember('v',ch(caitlin,:)) && ~ismember('r',ch(felicia,:))
     if length(intersect(ch(caitlin,:),ch(felicia,:)))==0
       if length(strfind([ch(caitlin,:),ch(bruce,:),ch(harold,:),ch(felicia,:)],'s'))==2
       if length(strfind([ch(caitlin,:),ch(bruce,:),ch(harold,:),ch(felicia,:)],'c'))==2
       if length(strfind([ch(caitlin,:),ch(bruce,:),ch(harold,:),ch(felicia,:)],'v'))==3
         if ismember('s',ch(caitlin,:))
            for i=bruce:harold
              fprintf('%-7s %2s\n',name(i), ch(i,:))
            end
         end
       end         
       end         
       end
     end
  end

end
end
end
end

Results showing initials of the flavors had by each:

bruce   vs
caitlin rs
felicia cv
harold  cv

  Posted by Charlie on 2022-12-11 11:19:00
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information