Brain-Teaser 483: Absentees
From The Sunday Times, 30th August 1970 [link]
Only seven men still had ammunition. Aden had 1 round, Bill 2 rounds, Cuff 3, Dudd 4, Edge 5, Ford 6 and Good 7. The commander ordered there should always be five of the seven men on duty and that the duty roster should be so arranged that those on duty never had fewer than 17 rounds of ammunition.
Next day he was told that only four men were on duty. It appeared that three of the five who should have been present were sick and that the four doing duty included two who should have been off. It so happened that the four had between them the same number of rounds as the five would have had.
The commander had no copy of the duty roster, but he knew how many rounds each of the seven men had.
He asked how many rounds the four men doing duty had between them. When given the figure the commander said, after some thought, that he could say with certainty who the three absentees were.
Can you name them?
This puzzle is included in the book Sunday Times Brain Teasers (1974).
[teaser483]
Jim Randell 9:16 am on 11 June 2019 Permalink |
We can identify the men by the number of rounds each man has.
Three men are sick, and two provide cover. The remaining two were scheduled to be on duty and actually were on duty.
This Python program runs in 81ms.
Run: [ @repl.it ]
from enigma import (irange, subsets, diff, filter_unique, unpack, printf) # the numbers of rounds available rounds = list(irange(1, 7)) # generate possible (<number of rounds>, <sick>, <cover>) def generate(): T = sum(rounds) # consider the 3 sick men for sick in subsets(rounds, size=3): # the number of rounds amongst the sick men is... n = sum(sick) # and so the total number of rounds on duty is... t = T - n if (t < 17): continue # find 2 men to cover with the same number of rounds for cover in subsets(diff(rounds, sick), size=2): if not (sum(cover) == n): continue yield (t, sick, cover) # find solutions where... (ss, _) = filter_unique( generate(), # ... if I knew the total number of rounds ... unpack(lambda t, s, c: t), # ... I could deduce who was sick unpack(lambda t, s, c: s), ) # output solutions for (t, s, c) in ss: printf("{t} rounds -> sick = {s}, cover = {c}")Solution: The three absentees are Aden, Cuff and Dudd.
A, C, D have 1+3+4 = 8 rounds between them, and are covered by B and F, who also have 2+6 = 8 rounds between them.
The remaining 2 men, E and G, with 5 + 7 = 12 rounds between them were scheduled to be on duty and were not sick.
So altogether there were 8 + 12 = 20 rounds on duty.
LikeLike