get gcd as a linear combination. Suppose A has two unmarked containers, one holds 19 liters and the other holds 51 liters. Explain how A can use his two containers to measure exactly one liter?
This is the problem.
I use gcd(19,51)=1 to back trace it. Then I get 3 * 51 - 8 *19 = 1. 
But if I have only this two containers, is there any way to get exactly 1 litre. 
That means I cannot use other containers.
Thank you in advance.
 A: The trick to solving such problems is that there are basically only four possible things one can do:  fill a container, empty a container, pour the entire contents of container A into container B, or pour the contents of container A into B until B is full.  If you start by filling the 51 container and then pouring the contents into the 19, discard it, and pour again into 19, and discard it, then you're left with 13 in the 51 container.   That's the first step.  Try solving it on your own now.
A: Let A can hold 51 liters and B can hold 19 liters.
Now you can fill A, then use B to make A remains 51 - 2*19 = 13 liters. Pour the remaining 13 liters in A into B. Fill A again. Then pour the 6 liters from A into B to fill B. Then A remains 51-6=45 liters. Use B to make A remains 45-2*19==7 liters, then pour these 7 liters from A into B. Fill A again and pour 19-7=12 liters from A into B. Now there are 51-12=39 liters in A. Finally, use A to fill B twice. The remain liters A will be 39-2*19=1 liter.
