T must be a multiple of GCD(X, Y). For GCD(X, Y) = 1, any value of T can be obtained - which is typical in such puzzles. This is all a non-straight forward way of saying that the usual problem is simple and boring.
This challenge puts further constraints on the problem and complicates it - to answer the following questions:
While I understand this is more of a math problem, there was sufficient interest in the chatterbox to post it. Ideas ranged from brute force, dynamic programming to towers of hanoi. Since the description in the first two paragraphs might not have made how this works clear, here is an example (which may not be optimal):
* Each "step" is defined as filling a jug or pouring a jug. For the example above, there are 7 steps. The amount of water was 9. If, in a more complicated problem, water needs to be poured on to the ground - that water would need to be accounted for as well. Since I don't know the answer to the questions above, it is possible that the optimal solution for steps is not the same as for water.X = 3, Y = 5, T = 4 GCD(X, Y) = 1 so we know it is possible 0. Starting state (X=0, Y=0, Z=0) 1. Fill X with 3 units of water (X=3, Y=0, Z=0) 2. Pour X into Z (X=0, Y=0, Z=3) 3. Fill X with 3 units of water (X=3, Y=0, Z=3) 4. Pour X into Y (X=0, Y=3, Z=3) 5. Fill X with 3 units of water (X=3, Y=3, Z=3) 6. Pour X into Y until Y is full (X=1, Y=5, Z=3) 7. Pour X into Z (X=0, Y=5, Z=4)
Update: Second paragraph was re-worded as blokhead pointed out via /msg that I had misunderstood and mistated something
Cheers - L~R
In reply to Challenge: N Jugs Problem by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |