P951 Weights II
Weights II
题目描述
Merchants measured many commodities using weights and a two-pan balance. If you are using a limited set of weights, however, you can only measure certain quantities accurately. For example, suppose that you have only two weights: a -ounce weight and a -ounce weight. With these you can easily measure out ounces, as shown in Figure 1.

It is somewhat more interesting to discover that you can also measure out ounces by shifting the -ounce weight to the other side, as shown in Figure 2.



