PDA

View Full Version : puzzle



shivshikha
May 20th, 2003, 12:26 AM
You have 8 litres of milk and you have an 8 litre can, 5 litre can and a 3 litre can.
How can u get 4 litres of milk ?

akdabas
May 20th, 2003, 12:34 AM
Let me try,

1. Fill 5 litre can with 5 liter

2. Fill 3 litre can from 5 litre can. Now 2 litre is left in the 5 litre can. put into 8 litre can.

3. Again fill the 5 litre can from 3 litre can and the remaining milk.

4. Again fill 3 litre can from 5 litre can. Put the remaining 2 litre in 8 litre can.

5. You got 4 litre in 8 litre can.

shivshikha
May 20th, 2003, 01:24 AM
Ashok Kumar Dabas (May 19, 2003 03:04 p.m.):
Let me try,

1. Fill 5 litre can with 5 liter


2. Fill 3 litre can from 5 litre can. Now 2 litre is left in the 5 litre can. put into 8 litre can.
--Don't forget the 8 litre can......

3. Again fill the 5 litre can from 3 litre can and the remaining milk.

4. Again fill 3 litre can from 5 litre can. Put the remaining 2 litre in 8 litre can.

5. You got 4 litre in 8 litre can.


Good try, but I think u need to be a little more elaborate.u r almost there .. when u transfer 5 litre from 8 litre, u forget to mention how much there is left in the 8 litre can...u have to use all 3 parameters

Let me make it easy
8 5 3
Initial state 8 0 0
Your Step 1 will be 3 5 0

Now continue......

anurag
May 20th, 2003, 01:52 AM
8 ltr (E); 5 ltr (F); 3 ltr (T)
State 1: 8 0 0
E ------> F

State 2: 3 5 0
F ------> T

State 3: 3 2 3
E <------ T

State 4: 6 2 0
F ------> T

State 5: 6 0 2
E ------> F

State 6: 1 5 2
F ------> T

State 7: 1 4 3

So now we have the 5 ltrs container that contains 4 ltrs of milk.

shivshikha
May 20th, 2003, 04:30 AM
Bingo !!!! Good Job .

There is another way to do it too..... !!! Any takers ??

shivshikha
May 20th, 2003, 04:38 AM
Anurag Kadyan (May 19, 2003 04:32 p.m.):
8 ltr (E); 5 ltr (F); 3 ltr (T)
State 1: 8 0 0
E ------> F

State 2: 3 5 0
F ------> T

State 3: 3 2 3
E <------ T

State 4: 6 2 0
F ------> T

State 5: 6 0 2
E ------> F

State 6: 1 5 2
F ------> T

State 7: 1 4 3

So now we have the 5 ltrs container that contains 4 ltrs of milk.

Anurag,
Very elegant, explanatory and systematic approach !!!!
Good job!

Shikha

navingulia
May 20th, 2003, 07:41 AM
ha ha ha
yo puzzle karni aasaan sai per likh kai samjhaani mushkil sai

uday
May 20th, 2003, 09:42 AM
topic in Artificial Intelligence book...

mbamal
May 21st, 2003, 02:12 AM
bhai jaat ne doodh dogey to chaye kitne hee can de do...end main sirf 0 liter doodh bachega...

anurag
May 21st, 2003, 09:24 AM
Thanx but basically it was ur idea, i just gave it a final shape.


Shikha Chaudhary (May 19, 2003 07:08 p.m.):
Anurag,
Very elegant, explanatory and systematic approach !!!!
Good job!

Shikha