The Lost Sheep Challenge
Andy Bradford
amb-plug at bradfords.org
Fri Sep 28 16:16:11 MDT 2007
Thus said "Sasha Pachev" on Fri, 28 Sep 2007 16:07:52 MDT:
> You have 100 sheep in a flock and they are all numbered. Each has an
> identification tag with a number - 1 through 100. One of them is lost.
> Other sheep are scattered over the pasture and cannot be examined in
> sequential order of their numbers. Come up with a method that would
> allow you to quickly identify the lost sheep. The use of a simple
> arithmetical calculator is allowed.
Hopefully its an HP with RPN, but that might violate your roll call
rule. :-)
Just add up the numbers 1--100 for a total of 5050. Then subtract each
sheeps number as you encounter it in the field (hopefully they don't
roam back and you double count them). The end result is the missing
sheep.
This probably isn't the best algorithm, but it seems it would work, no?
Andy
--
[-----------[system uptime]--------------------------------------------]
4:16pm up 7:10, 1 user, load average: 1.00, 1.00, 1.00
More information about the PLUG
mailing list