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

Home > Logic
Guard Schedule Surmise (Posted on 2022-08-28) Difficulty: 3 of 5
Art, Bob, Cab, and Ida are guards in a museum.

It is known that:
  1. Each of Art, Bob, and Cab stands guard on exactly four days every week.
  2. Exactly two persons stand guard together every day.
  3. No person stands guard three days in a row.
  4. Here is a partial listing that shows when they stand guard every week: +-----+-----+-----+ | Sun | Art | Bob | +-----+-----+-----+ | Mon | Cab | ? | +-----+-----+-----+ | Tues| Ida | ? | +-----+-----+-----+ | Wed | Art | ? | +-----+-----+-----+ |Thurs| Bob | ? | +-----+-----+-----+ | Fri | Cab | ? | +-----+-----+-----+ | Sat | Ida | ? | +-----+-----+-----+
Who does NOT stand guard with Ida?

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 2
clearvars, clc
string1='aciabci';
strings='aabbcc';
strings=uniqueperms(strings);
b=length(strings);
b=repmat('b',b,1);
strings=[b strings];
good=false;
i=1;
while i<= length(strings)
    x1=strfind(string1,'a');
    x2=strfind(strings(i,:),'a');
    tst='       ';
    tst(union(x1,x2))='a';
    aaa=strfind(tst,'aaa'); 
    x1=strfind(string1,'b');
    x2=strfind(strings(i,:),'b');
    tst='       ';
    tst(union(x1,x2))='b';
    bbb=strfind(tst,'bbb'); 
    x1=strfind(string1,'c');
    x2=strfind(strings(i,:),'c');
    tst='       ';
    tst(union(x1,x2))='c';
    ccc=strfind(tst,'ccc'); 

    if ~isempty(aaa) || ~isempty(bbb) || ~isempty(ccc)  
      strings(i,:)=[]; 
      i=i-1;
    end
       
  i=i+1;
end
i=1;
while i<= size(strings,1)   
    if sum(string1==strings(i,:))  
      strings(i,:)=[]; 
      i=i-1;
    end       
  i=i+1;
end
for i=1:size(strings,1)
  disp(string1)
  disp(strings(i,:))
end
disp(size(strings,1))

Checks for everything but one condition, but gives us a listing for the three remaining possibilities:

aciabci
babcabc 
aciabci
bacbcab
aciabci
bbcbcaa

The thing the program neglected to check for was that Friday, Saturday and Sunday are three days in a row (as are Saturday, Sunday and Monday), and the third possibility shown has Art working three days in a row over a weekend.

The first two possibilities remain, and in ehach of them Ida guards only with Bob on one day and Cab on another, never with Art.

  Posted by Charlie on 2022-08-28 10:44:44
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