Here's my effort to make the solution look as compact as possible.
Terminologies:
A: Fill the 4 gallon bucket
B: Fill the 9 gallon bucket
nA: Put n gallons in the 4 gallon bucket
nB: Put n gallons in the 9 gallon bucket
BA: Pour from B to A until A is full or B is empty
AB: Pour from A to B until B is full or A is empty
~A: Empty the 4 gallon bucket
~B: Empty the 9 gallon bucket
1G: B - BA - ~A - BA - ~A
2G: 1A - B - BA - ~A - BA - ~A
3G: 2A - B - BA - ~A - BA - ~A
4G: A
5G: 1B - A
6G: 2B - A
7G: 3B - A
8G: 4B - A
9G: B
10G: 1A - B
11G: 2A - B
12G: 3A - B
13G: 4A - B
lol wow Leo y u gotta make me look so dumb
(It's not hard when I'm not a total genius to begin with. lmao!)
This thread so needs to die though, so I'mma stop posting in here. lol
Here's my effort to make the solution look as compact as possible.
Terminologies:
A: Fill the 4 gallon bucket
B: Fill the 9 gallon bucket
nA: Put n gallons in the 4 gallon bucket
nB: Put n gallons in the 9 gallon bucket
BA: Pour from B to A until A is full or B is empty
AB: Pour from A to B until B is full or A is empty
~A: Empty the 4 gallon bucket
~B: Empty the 9 gallon bucket
1G: B - BA - ~A - BA - ~A
2G: 1A - B - BA - ~A - BA - ~A
3G: 2A - B - BA - ~A - BA - ~A
4G: A
5G: 1B - A
6G: 2B - A
7G: 3B - A
8G: 4B - A
9G: B
10G: 1A - B
11G: 2A - B
12G: 3A - B
13G: 4A - B
Comment