13. City $A$, City $B$, and City $C$ have 10, 10, and 8 units of a certain machine, respectively. Now it is decided to allocate these machines to City $D$ (18 units) and City $E$ (10 units). It is known that the transportation cost for one unit from City $A$ to City $D$ and City $E$ is 200 yuan and 800 yuan, respectively; from City $B$ to City $D$ and City $E$ is 300 yuan and 700 yuan, respectively; from City $C$ to City $D$ and City $E$ is 400 yuan and 500 yuan, respectively.
(1) Suppose $x$ units are transported from City $A$ and City $B$ to City $D$. After all 28 units are transported, find the function of the total transportation cost $W$ (yuan) in terms of $x$ (units), and determine the minimum and maximum values of $W$;
(2) Suppose $x$ units are transported from City $A$ to City $D$ and $y$ units are transported from City $B$ to City $D$. After all 28 units are transported, express the total transportation cost $W$ (yuan) in terms of $x$ and $y$, and determine the minimum and maximum values of $W$.
13. (1) From the problem, we know that the number of machines sent from City A, City B, and City C to City I are $x, x, 18-2x$, and the number of machines sent to City E are $10-x, 10-x, 2x-10$. Therefore,
$$
\begin{array}{l}
W=200 x+300 x+400(18-2 x)+800(10- \\
x)+700(10-x)+500(2 x-10) \\
=-800 x+17200 \text {. } \\
\text { Also, }\left\{\begin{array} { l } 
{ 0 \leqslant x \leqslant 1 0 , } \\
{ 0 \leqslant 1 8 - 2 x \leqslant 8 ; }
\end{array} \text { we have } \left\{\begin{array}{l}
0 \leqslant x \leqslant 10, \\
5 \leqslant x \leqslant 9,
\end{array}\right.\right. \\
\therefore 5 \leqslant x \leqslant 9 \text {. } \\
\therefore W=-800 x+17200 .(5 \leqslant x \leqslant 9, x \text { is an integer }) \\
\end{array}
$$

From the above equation, we can see that $W$ decreases as $x$ increases. Therefore, when $x=9$, $W$ reaches its minimum value of 10000 yuan; when $x=5$, $W$ reaches its maximum value of 13200 yuan.
(2) From the problem, we know that the number of machines sent from City A, City B, and City C to City D are $x, y, 18-x-y$, and the number of machines sent to City E are $10-x, 10-y, x+y-10$. Therefore,
$$
\begin{array}{l}
W=200 x+800(10-x)+300 y+700(10-y) \\
+400(18-x-y)+500(x+y-10) \\
=-500 x-300 y+17200 \text {. } \\
\text { Also, }\left\{\begin{array} { l } 
{ 0 \leqslant x \leqslant 1 0 , } \\
{ 0 \leqslant y \leqslant 1 0 , } \\
{ 0 \leqslant 1 8 - x - y \leqslant 8 , }
\end{array} \quad \therefore \left\{\begin{array}{l}
0 \leqslant x \leqslant 10, \\
0 \leqslant y \leqslant 10, \\
10 \leqslant x+y \leqslant 18,
\end{array}\right.\right. \\
\therefore W=-500 x-300 y+17200 \text {, and } \\
\left\{\begin{array}{l}
0 \leqslant x \leqslant 10, \\
0 \leqslant y \leqslant 10, \\
10 \leqslant x+y \leqslant 18 .
\end{array} \quad(x, y \text { are integers })\right. \\
W=-200 x-300(x+y)+17200 \\
\geqslant-200 \times 10-300 \times 18+17200=9800 \text {. } \\
\end{array}
$$

When $x=10, y=8$, $W=9800$. Therefore, the minimum value of $W$ is 9800.
$$
\text { Also, } \begin{aligned}
W & =-200 x-300(x+y)+17200 \\
& \leqslant-200 \times 0-300 \times 10+17200=14200 .
\end{aligned}
$$

When $x=0, y=10$, $W=14200$. Therefore, the maximum value of $W$ is 14200.
(Xu Hua provided)