Example 14. Let $x$ be a natural number from 1 to 10, the remainder of $x$ divided by 3 is $f(x)$, $y$ is a one-digit natural number, the remainder of $y$ divided by 4 is $g(y)$, then what is the maximum value of $x+2y$ when $f(x)+2g(y)=0$?
Solution: From the problem, we can obtain
$$
\begin{array}{l}
g(y)=\left\{\begin{array}{l}
0, y=4,8 ; \\
1, y=1,5,9 ; \\
2, y=2,6 ; \\
2, y=3,7 .
\end{array}\right. \\
\end{array}
$$
$\therefore f(x), g(y)$ are both non-negative.
To make $f(x)+2 g(y)=0$,
it is necessary that $f(x)=0$ and $g(y)=0$.
At this time, $x=3,6,3$,
$$
y=4,8 .
$$
The maximum value of $x$ is $9$, and the maximum value of $y$ is $8$.
$\therefore$ The maximum value of $x+2 y$ is $9+2 \times 8=25$.