Bowls with candys problem

As you’ll see, this post is somehow similar to boxes and coins problem.

Given 7 bowls, each with at least 80 candies. All the candies from some bowls weigh 10 grams, and all the candies from other bowls weigh 11 grams. Find what are the bowls that contain candies weighting 11 grams with one single weighting.

Solution (it is better to think a bit before to read the solution, you may have a better one):

To recap, we have 7 bowls and all the candies from each bowl weigh 10 grams or 11 grams.  So all the candies from some bowls weigh 11 grams, and we need to find exactly what are those bowls.

One solution is to take 1=2^0 candy from the first bowl, 2^1 candies from the second bowl, 2^2 candies from the third bowl , …. , 32=2^5 candies from the 6-th bowl , and 64=2^6 from the 7-th bowl. Let’s weigh all the candies taken above. The weight will be:

w = a_1 \cdot 2^0 + a_2 \cdot 2^1 + a_3 \cdot 2^2 + \cdots + a_7 \cdot 2^6 where a_i is the weight of the candies from the i-th bowl.

If all the selected candies would weigh 10 grams then their weight would be:

w = 10 \cdot 2^0 + 10 \cdot 2^1 + 10 \cdot 2^2 + \cdots + 10 \cdot 2^6

But some of them weigh 11 grams. The difference w'-w is:

w'' = d_1 \cdot 2^0 + d_2 \cdot 2^1 + d_3 \cdot 2^2 + \cdots + d_7 \cdot 2^6 where d_i is 0 if the corresponding candies weigh 10 grams or  1 if the corresponding candy weigh 11 grams.

But wait! This representation should be familiar to you :). It seems that d_i are the binary digits (base 2) of some number. That means that if we subtract w’ (which we can simply compute) from the weight of the selected candies we get a number and the base 2 representation of this number indicates what are the bowls having 11 grams coins.

Advertisements
This entry was posted in Math. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s