# Split 12 liters in half with 5 and 8 liter bottles [duplicate]

You have 12 liters of apple juice in a 12 liters bucket and you want to share it with your best friend. But you have an empty 8-liter and an empty 5-liter bottle.

How do you split the apple juice in half?

Source: fekraneh.ir

• @Gerhard In truth, duplicates don't have to go from new to old; if the newer question is better, then they can certainly go from old to new. Generally, we want the close target to be the better of the two, and the closed question to point to it.
– user20
Feb 7 '15 at 21:03
• Pour 6 liters into the 8-liter bottle. Your friend drinks from that and you drink from the bucket! Sep 8 '17 at 15:59

Here is a general algorithm. A and B are the 5 and 8 liter bottles. The 12-liter bottle is the juice reserve. The capacity is irrelevant.

• A empty => fill A from reserve
• B full => empty B into reserve
• else => transfer juice from A to B

Depending on which bottle is A and which is B, you get a 7-step or a 18-step solution. (Or one less step if you accept solutions where one part is split in 2 bottles)

This, by the way, works for every 2-bucket problem. If it has a solution.

PS: I realized the capacity of the 12-bottle is not irrelevant since it is less than 8+5. It can be used for a 10-move solution.

Here is a possible solution:

STEP        0   1   2   3   4   5   6   7
-------------------------------------------
5-Liter     0   0   5   0   3   3   5   0
8-Liter     0   8   3   3   0   8   6   6
12-Liter    12  4   4   9   9   1   1   6

• well if both friends are simply required to drink 6 liters each then you could stop at step 6 above and let one friend drink the 8lt bucket and the other would drink the two remaining buckets. Sep 3 '14 at 8:01
• @Hubble07 If you could do that, then have one drink the 3 liters at step 2, then fill the 8-liter bucket and pour it into the 5-liter bucket again, leaving the drinker's remaining 3 liters in the 8-liter bucket. Sep 3 '14 at 20:28
• @RobWatts Indeed. Question is not about drinking the juice. But in Hubble07's answer your friend can take 8 and 5 liters bottles with him/herself... BTW who can drink 6 liters of a juice? lol
– Rafe
Sep 4 '14 at 5:19

First pour the water in the bucket into the 8-litre bottle, then 4 litres remain in the former.

Step 2: pour the water in the 8-litre bottle into the 5-litre bottle, now there'll be 4 litres in the bucket, 3 in the 8-litre bottle and 5 in the remaining one.

Then add the water in the 5-litre bottle to the bucket - there'll be 9 litres in the latter and 3 in the 8-litre one.

Now pour the water in the 8-litre bottle into the 5-litre bottle and fill the 8-litre bottle with the 12-litre bottle - there'll be 1 litres in the bucket, 8-litre one will be full and 3 litres will be in the 5-litre one.

Finally fill the 5-litre bottle using the 8-litre one and pour all the water in the 5-litre bottle into the bucket.