Example 2.1.5 Color the vertices of a square pyramid $S A B C D$, so that the endpoints of the same edge have different colors. If only 5 colors are available, how many coloring schemes are there?
Solution: The coloring method that satisfies the conditions of the problem requires at least three colors.
(1) If exactly three colors are used, we can first consider that $S$ has $\mathrm{C}_{5}^{1}$ choices. After $S$ is chosen, $A B C D$ must select two colors from the remaining 4 colors, which has $\mathrm{C}_{4}^{2}$ ways. After the colors are chosen, only $A$ and $C$ can be the same color, and $B$ and $D$ can be the same color, leaving $\mathrm{C}_{2}^{1}$ choices.
Therefore, there are $\mathrm{C}_{5}^{1} \cdot \mathrm{C}_{4}^{2} \cdot \mathrm{C}_{2}^{1}=60$ ways.
(2) If exactly four colors are used, first choose $S$ with $\mathrm{C}_{5}^{1}$ ways, then select 2 colors from the remaining 4 colors to color $A$ and $B$. Since the colors of $A$ and $B$ can be swapped, there are $\mathrm{P}_{4}^{2}$ ways to color.

Then, choose one of the remaining two colors to color $C$ or $D$, so there are $\mathrm{C}_{5}^{1} \cdot \mathrm{P}_{4}^{2}\left(\mathrm{C}_{2}^{1}+\mathrm{C}_{2}^{1}\right)=$ 240 ways.
(3) If exactly 5 colors are used, then the coloring method has $\mathrm{P}_{5}^{5}=120$ ways.
In summary, the total number of coloring methods that satisfy the conditions of the problem is $60+240+120=420$ ways.