i need an extra container to collect the 4 quarts of water.. then there are two ways..
1.fill the 5q bucket with the 3q bucket water..twice..excess 1q of water is collected in the container..then add 3q to it using the respective bucket..
2.fill the 3q bucket with 5q twice each time emptying the 3q bucket...excess 4q is collected in the container..
The problem clearly states that you are given only a 3- and 5- quart container. You can't just decide to add in a container of you own! Why not just make the container that you bring along a 4-quart one and be done with it?
There are several ways to do this but the following is pretty efficient.
Fill the 5-quart container and then fill the 3 from the 5. That leaves 2 quarts in the 5. Empty out the 3. Pour the remaining 2 quarts from the 5 into the 3.
Fill the 5 again and top up the 3 (this requires 1 quart). That leaves 4 quarts in the 5.
I got a better question for all of you,, assume you have three containers of 8L, 5L, 3L capacity and 8L container is filled completely with milk(not water), separate 4L of milk in any of the containers(obviously either 5L or 8L) Constraint : you can't throw away the milk :P
Answer: for you to confirm your answer:it needs 7 steps
Fill the 5 qt bucket, pour it into the 3 qt bucket. Throw away the full 3 qt bucket, add the remaining two qts from the 5 qt bucket to the 3 qt bucket. Fill the 5 qt bucket, from this fill the 3qt bucket which leave 4 qts in the 5 qt bucket.
Fill the five. Use the five to fill the three. Empty the three. Pour the remaining 2 from the five into the three. Fill the five. Empty five into the three until three is full. There should be exactly four in the five now
10 comments:
i need an extra container to collect the 4 quarts of water..
then there are two ways..
1.fill the 5q bucket with the 3q bucket water..twice..excess 1q of water is collected in the container..then add 3q to it using the respective bucket..
2.fill the 3q bucket with 5q twice each time emptying the 3q bucket...excess 4q is collected in the container..
"God" is wrong again!! When will it end?
The problem clearly states that you are given only a 3- and 5- quart container. You can't just decide to add in a container of you own! Why not just make the container that you bring along a 4-quart one and be done with it?
There are several ways to do this but the following is pretty efficient.
Fill the 5-quart container and then fill the 3 from the 5. That leaves 2 quarts in the 5. Empty out the 3. Pour the remaining 2 quarts from the 5 into the 3.
Fill the 5 again and top up the 3 (this requires 1 quart). That leaves 4 quarts in the 5.
Fill the 5q bucket, empty to the 3q bucket, 2q would be left in 5q, put 2q into the target, empty the 3q bucket.
Repeat the same.
3 5
-----------
3->3 0
0(3->)3
3->3 3
1(2->)5
1 0 ->5
0(1->)1
3->3 1
0(3->)4
5l------3l
**********
5-------0
2-------3
2-------0
0-------2
5-------2
4-------1*filled---6steps
else
5l------3l
**********
0-------3
3-------0
3-------3
5-------1
0-------1
1-------0
1-------3
4-------0*filled--8steps
5l------3l
**********
5-------0
2-------3
2-------0
0-------2
5-------2
4-------3*filled---6steps
Please look at this post for the easiet solution --
http://wiki.answers.com/Q/If_you_had_an_infinite_supply_of_water_and_a_5_quart_and_3_quart_pail_how_would_you_measure_exactly_4_quarts
I got a better question for all of you,, assume you have three containers of 8L, 5L, 3L capacity and 8L container is filled completely with milk(not water), separate 4L of milk in any of the containers(obviously either 5L or 8L)
Constraint : you can't throw away the milk :P
Answer: for you to confirm your answer:it needs 7 steps
Fill the 5 qt bucket, pour it into the 3 qt bucket. Throw away the full 3 qt bucket, add the remaining two qts from the 5 qt bucket to the 3 qt bucket. Fill the 5 qt bucket, from this fill the 3qt bucket which leave 4 qts in the 5 qt bucket.
Fill the five. Use the five to fill the three. Empty the three. Pour the remaining 2 from the five into the three. Fill the five. Empty five into the three until three is full. There should be exactly four in the five now
Post a Comment