Quote:
|
Originally Posted by Denman
...I...only have a traditional weighing machine.
|
You mean a balance scale, right? The key is to recognize that you can put weights on both sides of the scale to either add to or subtract from the item being weighed. A "balanced ternary" number system fits this problem perfectly, so the weights are 1, 3, 9, and 27 kg.
Code:
1 (given)
2 = 3 - 1
3 (given)
4 = 3 + 1
5 = 9 - 3 - 1
6 = 9 - 3
7 = 9 - 3 + 1
8 = 9 - 1
9 (given)
10 = 9 + 1
:
38 = 27 + 9 + 3 - 1
39 = 27 + 9 + 3
40 = 27 + 9 + 3 + 1