Brain-Teaser 482: [Alphabetical cricket]
From The Sunday Times, 23rd August 1970 [link]
The Alphabet CC ended last season with a fine win against the Early Closers XI. Declaring at 155 for six they dismissed their opponents with only minutes to spare. The Early Closers’ captain, Bond, made a spirited 71 not out.
“Nice gesture of the opposition to bat in alphabetical order”, said C. F. Arrowroot, the Alphabet president; “And did you notice that each one of the first three wickets fell when the total was the product of Bond’s score and that of the outgoing batsman?”
“Even odder”, commented B. P. Biggin, “except when Collins was out the total at the fall of every one of their wickets was the square of the dismissed batsman’s score.”
No one made a “duck” and there was just one “extra”. I should perhaps add that no two Early Closers had the same surname initial.
How many did Collins score, and what was Bond’s score at the fall of the seventh wicket?
This puzzle was originally published with no title.
[teaser482]
Jim Randell 1:09 pm on 6 June 2019 Permalink |
Although not explicitly mentioned in the puzzle text, presumably we are talking about a cricket match.
B is one of the first pair to go into bat, and at the 10th dismissal he is “not out”, so he is paired with every other batsman. If there is an A, he would be in the first pair (and the first to be dismissed), and C would be next (and be the second to be dismissed). If there isn’t an A, C would be in the first pair and be the first to be dismissed. So C is either the first or second batsman to be dismissed.
I tackled this problem in 2 parts. The first part deals with the first three dismissals, where the score is always the product of B’s score and the dismissed batsman’s score (and two of the scores have to be the square of the dismissed batsman’s score – the one that isn’t identifies C).
The second part deals with the remaining dismissals (4th – 10th) the scores have to be the square of the dismissed batsman’s score.
When the 10th batsman is dismissed the total score must be a square less than 155, so not more than 12².
This program runs in 80ms.
Run: [ @repl.it ]
from enigma import (irange, div, printf) # solve the first three dismissals, at each the total score is the # product of B's score and the dismissed batsman's score and all, # except C, the total is the square of the dismissed batsman's score. # return ([(<B's score>, <dismissed score>, <extras>), ...], <C>) # t = total so far # b = B's current score # ds = scores at dismissals # x = current extras # c = identify C def solve1(t=0, b=0, ds=[], x=0, c=None): n = len(ds) # are we done? if n == 3: # check C has been allocated if c in (0, 1): yield (ds, c) else: # possible extra for x2 in irange(x, 1): # possible current score for B for b2 in irange(b, 71): # calculate the score for the dismissed batsman (d) # t2 = t + (b2 - b) + d + (x2 - x) = b2 * d # so: # d = (t + b2 + x2 - b - x) / (b2 - 1) d = div(t + b2 + x2 - b - x, b2 - 1) if d is None or d < 1: continue t2 = b2 * d # is the total the square of d? c2 = c if t2 != d * d: # this must be C if c is not None: continue c2 = n yield from solve1(t2, b2, ds + [(b2, d, x2)], x2, c2) # solve the remaining dismissals, at each the total score is the # square of the dismissed batman's score # t = total score so far # b = B's current score # ds = scores of B and dismissed batsman # x = extra (0 or 1) def solve2(t=0, b=0, ds=[], x=0): n = len(ds) # are we done? if n == 10: # check an extra has been scored and B's score is 71 if x == 1 and ds[-1][0] == 71: yield ds else: # possible extra for x2 in irange(x, 1): # possible scores for next batsman for d in irange(1, 12): # the new total is... t2 = d * d if not (t < t2 < 155): continue # calculate the current score for B b2 = t2 + b + x - t - d - x2 if b2 < b: continue yield from solve2(t2, b2, ds + [(b2, d, x2)], x2) # solve for the first 3 dismissals for (ds1, c) in solve1(): (b, d, x) = ds1[-1] # solve for the remaining dismissals for ds in solve2(b * d, b, ds1, x): # output the solution printf("[ds={ds}]") printf("-> C={C} [i={c}]; B[i=6]={B}", C=ds[c][1], B=ds[6][0])Solution: Collins scored 5. Bond had scored 41 at the 7th dismissal.
The scores for the batsman (in dismissal order) were:
And the total scores at each dismissal were:
So there is an A (who was dismissed first). The extra was scored between A’s dismissal and C’s dismissal.
Bond’s scores at each dismissal were:
LikeLike