So, I guess you would like to solve linear diophantine equations(LDE) in two variables. Alright, so here is the recipe. First, we would like to know whether the equation $ax+by=c$ is solvable or not. A necessary and sufficient condition is established by Bezout's Lemma (see Wikipedia) which states that if the $\gcd(a,b)|c$ then the equation $ax+by=c$ has solutions. This should make sense right, I mean if I write something like $4x+2y=3,$ then you can factor out the $2$ and claim that $2(2x+y)=3\Rightarrow 2|3$ which is absolute nonsense. Next, we would like to know how many solutions there are to the LDE. In general if $d=\gcd(a,b)$ then there are $d$ mutually incongruent solutions to the LDE.
Now how do we get those solutions? Well, this is where Euclid's Algorithm comes to the rescue. Often you'll find that it is easy to guess a solution to an LDE by inspection, for example, if I ask you to solve $3x-2y=1$, you'll right away claim that $x=1,y=1$ satisfy this equation. On the other hand, complicated equations involving large coefficients (like the one you've mentioned) require more than inspection. In cases where a particular solution cannot be obtained by inspection, we use Euclid's Algorithm.
We first find a particular solution using Euclid's Algorithm say $(x_0,y_0)$ and in order to obtain a general solution to the LDE we write that $x=x_0+\frac{b}{d}t$ and $y=y_0-\frac{a}{d}t$, where $d=\gcd(a,b)$ and $t$ is an integer. You can verify this as follows: We began with the claim that $ax_0+by_0=c$, then if we replace $x$ and $y$ by the general solutions we get:$$a(x_0+\frac{b}{d}t)+b(y_0-\frac{a}{d}t)=ax_0+by_0+\frac{ab}{d}t-\frac{ba}{d}t=c.$$ Voilà! we've got the general solution of the LDE.
I am guessing that you might also have a problem with obtaining the particular solution from Euclid's Algorithm: Well the way we do it as follows-
Say we have the LDE $$18x+189y=81$$ and we would like to obtain a particular solution since its hard to guess by inspection. So we first write divide both sides $9$ or in general by the gcd (which is always possible by Bezout's Lemma if the LDE is solvable) and hence we obtain $2x+21y=9.$ Now $21=2*10+1$ and so $21(1)+2(-10)=1$ and so $21(9)+2(-90)=9\Rightarrow 18(-90)+189(9)=81$ and there you have it $x_0=-90$ and $y_0=9$ by Euclid's Algorithm.