[CrackMonkey] [schoen@loyalty.org: Pill-weighing]
Mr. Bad
mr.bad at pigdog.org
Sun Feb 13 19:25:11 PST 2000
>>>>> "B" == Bad <mr.bad at pigdog.org> writes:
B> This gets mucked up if you have 100 or more bottles,
B> though. Another way you could do it is for bottle X, put 100 *
B> (10 ^ ((X - 1) * 3) pills on. In other words, for bottle 1,
B> put 100 pills on. For bottle 2, put 100,000 pills on. For
B> bottle 3, put 100,000,000 pills on. Then you'll get a reading
B> like 100101100. You can tell its the 2nd bottle that has the
B> bad pills, because it's where the "101" shows up.
Actually, now that I look at it, that's kind of lazy. You can do it
with a lot fewer pills. For each bottle X, put on 10 ^ (X + 1)
pills. So, for bottle 1, put on 100 pills. For bottle 2, put on 1000
pills, for bottle 3, put on 10000 pills. If all the pills are honest,
you'd get a number like:
1111100
But if there's a bunch of 101 pills in any of the bottles, you'll get
a number like:
1121110
You can see that a "bad" bottle causes an extra value 2 places
down. In this example, bottles 2 and 5 are bad.
~Mr. Bad
More information about the Crackmonkey
mailing list