Brain-Teaser 515: [Herb gardens]
From The Sunday Times, 25th April 1971 [link]
Five little girls wanted herb gardens. Mother gave them five kinds and said:
“There are three clumps of each sort. Now each take three clumps, but so that you have three different kinds in your garden, and so that not one of you has the same three as anyone else.”
Anne now has two the same as Eve, whose third is common to Beth and Carol. Carol has two the same as Beth, but not the parsley, which Beth has. Dot has mint, and shares two others with Anne. Eve didn’t really like any of Dot’s choice, but they have to share the one Beth and Carol don’t have. Dot doesn’t have rue, and only one person has rue with mint, and one with parsley and thyme.
Who had sage and who had thyme?
This puzzle was originally published with no title.
[teaser515]
Jim Randell 9:18 am on 12 March 2020 Permalink |
Programatically, we can try all possible assignments of selections of herbs to the girls.
This Python program runs in 94ms.
Run: [ @repl.it ]
from enigma import subsets, join, printf # possible choices ss = list(map(set, subsets("MPRST", size=3, select="C"))) # choose different sets for each of the girls for (A, B, C, D, E) in subsets(ss, size=5, select="P"): # A does not have M # B has P # C does not have P # D has M, does not have R if 'M' in A or 'P' not in B or 'P' in C or 'M' not in D or 'R' in D: continue # A has 2 the same as E AnE = A.intersection(E) if len(AnE) != 2: continue # and E's other one is common to B and C # B and C share 2 BnC = B.intersection(C) if len(BnC) != 2: continue EdA = E.difference(A) if not EdA.issubset(BnC): continue # A and D share 2 AnD = A.intersection(D) if len(AnD) != 2: continue # D and E share 1, and neither B nor C have it DnE = D.intersection(E) if len(DnE) != 1 or DnE.issubset(B.union(C)): continue # only one has M+R, only one has P+T count = lambda s: sum(x.issuperset(s) for x in (A, B, C, D, E)) if not(count('MR') == 1 and count('PT') == 1): continue # output solutions collect = lambda k: join(x for (x, s) in zip("ABCDE", (A, B, C, D, E)) if k in s) (A, B, C, D, E) = (join(sorted(x)) for x in (A, B, C, D, E)) printf("A={A} B={B} C={C} D={D} E={E} -> S={S} T={T}", S=collect('S'), T=collect('T'))Solution: Anne, Dot, Eve have sage. Beth, Carol, Eve have thyme.
There are two possible sets of herbs (B has a choice of two different selections):
LikeLike