Miss Alden, Miss Brent, Miss Clark, Miss Doyle and Miss Evans have short first and middle names.
- Four of them have a first or middle name of Fay, three of them have a first or middle name of Hay, two of them have a first or middle name of Kay and one of them has a first or middle name of May.
- Either Miss Alden and Miss Brent are both named Kay or Miss Clark and Miss Doyle are both named Kay.
- Of Miss Brent and Miss Clark, either both are named Hay or neither is named Hay.
- Miss Doyle and Miss Evans are not both named Fay.
Who is named May?
DECLARE SUB permute (a$)
CLS
f$ = "ffffhhhkkm": h$ = f$
DO
a$ = MID$(f$, 1, 2)
b$ = MID$(f$, 3, 2)
c$ = MID$(f$, 5, 2)
d$ = MID$(f$, 7, 2)
e$ = MID$(f$, 9, 2)
fct = 0: hct = 0: kct = 0
IF INSTR(a$, "f") > 0 THEN fct = fct + 1
IF INSTR(b$, "f") > 0 THEN fct = fct + 1
IF INSTR(c$, "f") > 0 THEN fct = fct + 1
IF INSTR(d$, "f") > 0 THEN fct = fct + 1
IF INSTR(e$, "f") > 0 THEN fct = fct + 1
IF INSTR(a$, "h") > 0 THEN hct = hct + 1
IF INSTR(b$, "h") > 0 THEN hct = hct + 1
IF INSTR(c$, "h") > 0 THEN hct = hct + 1
IF INSTR(d$, "h") > 0 THEN hct = hct + 1
IF INSTR(e$, "h") > 0 THEN hct = hct + 1
IF INSTR(a$, "k") > 0 THEN kct = kct + 1
IF INSTR(b$, "k") > 0 THEN kct = kct + 1
IF INSTR(c$, "k") > 0 THEN kct = kct + 1
IF INSTR(d$, "k") > 0 THEN kct = kct + 1
IF INSTR(e$, "k") > 0 THEN kct = kct + 1
IF fct = 4 AND hct = 3 AND kct = 2 THEN
IF INSTR(a$, "k") > 0 AND INSTR(b$, "k") > 0 OR INSTR(c$, "k") > 0 AND INSTR(d$, "k") > 0 THEN
IF (INSTR(b$, "h") > 0) = (INSTR(c$, "h") > 0) THEN
IF INSTR(d$, "f") = 0 OR INSTR(e$, "f") = 0 THEN
PRINT a$; " "; b$; " "; c$; " "; d$; " "; e$; " "
END IF
END IF
END IF
END IF
permute f$
LOOP UNTIL f$ = h$
finds possible sets of initials for MSs Alden, Brent, Clark, Doyle and Evans as follows:
A B C D E
fh fm fk hk fh
fh fm fk hk hf
fh fm fk kh fh
fh fm fk kh hf
fh fm kf hk fh
fh fm kf hk hf
fh fm kf kh fh
fh fm kf kh hf
fh mf fk hk fh
fh mf fk hk hf
fh mf fk kh fh
fh mf fk kh hf
fh mf kf hk fh
fh mf kf hk hf
fh mf kf kh fh
fh mf kf kh hf
hf fm fk hk fh
hf fm fk hk hf
hf fm fk kh fh
hf fm fk kh hf
hf fm kf hk fh
hf fm kf hk hf
hf fm kf kh fh
hf fm kf kh hf
hf mf fk hk fh
hf mf fk hk hf
hf mf fk kh fh
hf mf fk kh hf
hf mf kf hk fh
hf mf kf hk hf
hf mf kf kh fh
hf mf kf kh hf
Miss Brent is either May Fay or Fay May.
|
Posted by Charlie
on 2014-01-07 14:47:33 |