wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> easy >> You have a jug that holds five gallons
(Message started by: UgoLocal02 on Jun 12th, 2014, 2:17am)

Title: You have a jug that holds five gallons
Post by UgoLocal02 on Jun 12th, 2014, 2:17am
You have a jug that holds five gallons, and a jug that holds three gallons. You have no other containers, and there are no markings on the jugs. You need to obtain exactly seven gallons of water from a faucet. How can you do it?

Second Problem: You need exactly four gallons. How do you do it?

Title: Re: You have a jug that holds five gallons
Post by Lupin on Jul 5th, 2014, 6:57pm
Wonder why no one has tackled this one.

For seven (and four) gallons: [hide] Fill 5-gallon jug.  From this jug, fill 3-gallon jug.  Two gallons are left on 5-gallon jug.  Empty 3-gallon jug.  Transfer contents of 5-gallon jug into 3-gallon jug.  Now fill 5-gallon jug with water.  You have exactly seven gallons (5+3)   If you need four gallons, then fill 3-gallon jug (which contains 2 gallons) from 5-gallon jug and four gallons are left on 5-gallon jug. [/hide]

Can you measure exactly  1, 2, 3, 4, 5, 6, 7, 8 gallons? :D

OK, so not exactly let’s say approximately

Title: Re: You have a jug that holds five gallons
Post by rloginunix on Jul 5th, 2014, 7:55pm
total capacity.liters now. remaining capacity, e.g 3.2.1 = 3-liter jug has 2 liters in it and can fit 1 more liter.

Exactly:

8: 3.3.0 + 5.5.0
7: [hide]5.5.0 - 3 -> 3.0.3 = 5.2.3, 3.3.0; 3.0.3; 5.2.3 - 2 -> 3.0.3 = 3.2.1, 5.0.5; 5.5.0[/hide]
6: [hide]3.3.0 - 3 -> 5.0.5 = 3.0.3, 5.3.2; 3.3.0 - 2 -> 5.3.2 = 3.1.2, 5.5.0[/hide]
5: 5.5.0
4: [hide]5.5.0 - 3 -> 3.0.3 = 5.2.3, 3.3.0; 3.0.3; 5.2.3 - 2 -> 3.0.3 = 3.2.1, 5.0.5; 5.5.0 - 1 -> 3.2.1 = 3.3.0, 5.4.1[/hide]
3: 3.3.0
2: [hide]5.5.0 - 3 -> 3.0.3 = 5.2.3, 3.3.0[/hide]
1: see 6.



[edit]
Hid number 2 as per dudiobugtron's notice.
By doing the number six in a more laborious way I was able to reuse it for number one.
Somehow I've totally missed the discussion that followed after my post.
Sorry.
[/edit]

Title: Re: You have a jug that holds five gallons
Post by EdwardSmith on Jul 6th, 2014, 2:25am
There are two ways of doing this.
Firstly fill the five gallon jug. Drink one gallon. You are left with 4 gallons.
Or
Fill both jugs. Drink four gallons from the five gallon jug then top it up with the 3 gallon jug.

Title: Re: You have a jug that holds five gallons
Post by dudiobugtron on Jul 6th, 2014, 4:11pm
rloginunix - your solution to '2' should be hidden, since [hide]it is as likely to help you get 7 as the solution to 4 is. (2 + 5 = 4 + 3)[/hide]

Also, your solution to 6 has an unnecessary step at the end. :P [hide]3 + 3 = 1 + 5[/hide]

A further question: imagine the jugs are constructed such that they can hold any integer number of litres of water less than or equal to their capacity.  At the start, they both hold zero litres.  The 'extra' negative litres are accessed through a secret compartment, so as well as filling the jugs to capacity, you can also fill them up to zero, and empty them down to zero.  Can you get a jug with -1 litres?  Can you get a jug to contain any arbitrary n < 0 ?


on 07/06/14 at 02:25:38, EdwardSmith wrote:
There are two ways of doing this.
Firstly fill the five gallon jug. Drink one gallon. You are left with 4 gallons.
Or
Fill both jugs. Drink four gallons from the five gallon jug then top it up with the 3 gallon jug.

I like these answers aesthetically. But of course unless you yourself are a measuring jug, you can't determine how many gallons you have consumed.

Title: Re: You have a jug that holds five gallons
Post by towr on Jul 6th, 2014, 10:07pm

on 07/06/14 at 16:11:14, dudiobugtron wrote:
A further question: imagine the jugs are constructed such that they can hold any integer number of litres of water less than or equal to their capacity.  At the start, they both hold zero litres.  The 'extra' negative litres are accessed through a secret compartment, so as well as filling the jugs to capacity, you can also fill them up to zero, and empty them down to zero.  Can you get a jug with -1 litres?
Sure, [hide] 5 - 3 - 3[/hide]


Quote:
Can you get a jug to contain any arbitrary n < 0 ?

[hide]-2 = 3 - 5
So we can get 0, -1 and -2, and therefor we can get any negative number by just repeatedly removing 3 (after moving the measured amount to 5 if necessary)[/hide]

Title: Re: You have a jug that holds five gallons
Post by lillianj on Aug 19th, 2014, 11:59am
confuse for me  ???

Title: Re: You have a jug that holds five gallons
Post by movie4fun on Aug 20th, 2014, 1:01am
First problem- Fill [hide]5 and then fill 3 using the water from 5. then empty 3 and put the two gallon from 5 to 3. and now fill 5 again.[/hide] you have 7 in total.

Second problem-  fill [hide] three and put all in 5. then fill 3 again and pour as much as you can to 5. so 5 is full and three has 1. now empty 5 and take the 1 from 3 to 5. and now fill 3 again. [/hide]in total you will have 4.

Title: Re: You have a jug that holds five gallons
Post by Technologeek on Sep 2nd, 2014, 10:00pm
I already knew it  ;D

Title: Re: You have a jug that holds five gallons
Post by wakiza33 on Sep 10th, 2014, 9:09am
A classic.

Title: Re: You have a jug that holds five gallons
Post by Grimbal on Sep 12th, 2014, 12:58am
I think I have given the solution somewhere else:

[hideb]- if A is empty, fill A,
- if B is full, empty B,
- else transfer from A to B.

Continue until you have the wanted quantity in A, B or A+B.
[/hideb]
That works for all 2-bucket problems.  It doesn't matter which one is A and which one B.

Title: Re: You have a jug that holds five gallons
Post by Annettagiles on Nov 4th, 2014, 3:37am
How is it possible?

Title: Re: You have a jug that holds five gallons
Post by csendra on Nov 21st, 2014, 10:51pm
yes agree with the EdwardSmith that Firstly fill the five gallon jug. Drink one gallon. You are left with 4 gallons. Or Fill both jugs. Drink four gallons from the five gallon jug then top it up with the 3 gallon jug.
else i don't think so there is another solution of it

Title: Re: You have a jug that holds five gallons
Post by Littleton on Nov 22nd, 2014, 3:55am
Just fill one halfway!  ;D

Title: Re: You have a jug that holds five gallons
Post by anglia on Aug 24th, 2015, 10:39pm
Drink one and 7 would be left.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board