Jars and marbles 问题

You have 10 jars, each filled with many marbles. Each marble weighs exactly 1.0 grams. One of the jars is a bad batch meaning each marble inside weighs 1.1 grams instead of 1.0 grams. You have a scale that will give you back a number of how much things weigh on it. Using only one measurement, determine how would you be able to find the bad batch


scale是秤的意思


答案是:

Line up the jars in some fashion. 
Take 1 marble from the first jar 
Take 2 marbles from the second jar 
Take 3 marbles from the third jar 
and so forth up to the ninth jar 
Don't take any from the tenth jar 
 
Put the marbles on the scale. 
 
If the scale reads a whole number, then the tenth jar is the jar that contains the marbles that weigh 1.1g 
 
If the scale reads #.1 then it is the first jar that contains marbles that weigh 1.1g (1x1.1 will give you #.1)
 
If the scale reads #.2 then it is the second jar that contains marbles that weigh 1.1g (2x1.1 will give you #.2) 
 
If the scale reads #.3 then it is the third jar that contains marbles that weigh 1.1g (3x1.1 will give you #.3) 
 
and so forth 


如果一个jar里面可以有1个或两个1,1g 的marble,那么为了产生每个独立的组合,则下一个要比上一组大。


你可能感兴趣的:(Jars and marbles 问题)