Rakesh Joshi

Ranch Hand

Posts: 218

posted 11 years ago

Mary has a full 8-quart container (Container A) of peanut oil. She wants to share half of the oil with her sister. She has another 2 empty containers (B and C) with the capacities: 5 quarts and 3 quarts. Can you, without weighing the containers, put 4 quarts of oil in container B with the least number of steps for her sister?

Life is a Game play it.

posted 11 years ago

One quick solution -

(1) Take out 3 quarts of oil from A into C. A has 5 quarts left now.

(2) Transfer 3 quarts from C to B. Now B has 3, A has 5 and C has zero.

(3) Take out Another 3 quarts from A into C. A=2, B=3, and C=3 now.

(4) Transfer from C to B only till B is full. A=2, B=5 and C=1 ((3-2)) now.

(5) Empty B in A now. A=7, B=0 and C=1;

(6) Put C in B. A=7, B=1 and C=0;

(7) Take out 3 quarts from A to C. A=4, B=1 and C=3.

(8) Transfer C to B. A=4, B=4 and C=0.

Done! Shorter maybe.....

- Manish

[ March 24, 2006: Message edited by: Manish Hatwalne ]

(1) Take out 3 quarts of oil from A into C. A has 5 quarts left now.

(2) Transfer 3 quarts from C to B. Now B has 3, A has 5 and C has zero.

(3) Take out Another 3 quarts from A into C. A=2, B=3, and C=3 now.

(4) Transfer from C to B only till B is full. A=2, B=5 and C=1 ((3-2)) now.

(5) Empty B in A now. A=7, B=0 and C=1;

(6) Put C in B. A=7, B=1 and C=0;

(7) Take out 3 quarts from A to C. A=4, B=1 and C=3.

(8) Transfer C to B. A=4, B=4 and C=0.

Done! Shorter maybe.....

- Manish

[ March 24, 2006: Message edited by: Manish Hatwalne ]

posted 11 years ago

Dear Hat Waale/ Joshi.

Yes Thats right. Now this question should be closed. Rakesh do you have any query regarding this question. Please ask to Hat Waale. otherwise give your confirmation.

Yes Thats right. Now this question should be closed. Rakesh do you have any query regarding this question. Please ask to Hat Waale. otherwise give your confirmation.

The Best way to predict your future is to create it - Every great individual common man

posted 11 years ago

Ankur,

I have a proper name - Manish. Please use that and do not make fun of my surname, though you may not have inteded it that way.

- Manish

Originally posted by Ankur Sharma:

Dear Hat Waale/ Joshi.

Yes Thats right. Now this question should be closed. Rakesh do you have any query regarding this question. Please ask to Hat Waale. otherwise give your confirmation.

Ankur,

I have a proper name - Manish. Please use that and do not make fun of my surname, though you may not have inteded it that way.

- Manish

Ray Stojonic

Ranch Hand

Posts: 326

Zip Ped

Ranch Hand

Posts: 336

posted 11 years ago

Manish I am really sorry for that, if you hurt but beleive me that was not intended that was totally a typo mistake........ pls don't get hurt... I extremly apolozise for this typo mistake.........

I hope now onwards you don't have any wrong spirit for me...

---Ankur,

I have a proper name - Manish. Please use that and do not make fun of my surname, though you may not have inteded it that way.

- Manish

Manish I am really sorry for that, if you hurt but beleive me that was not intended that was totally a typo mistake........ pls don't get hurt... I extremly apolozise for this typo mistake.........

I hope now onwards you don't have any wrong spirit for me...

It is sorta covered in the JavaRanch Style Guide. |